home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 602 / Help-FilesOPLDeveloppers.sis / S5 OPL (.txt) < prev    next >
Encoding:
EPOC Database  |  2000-10-04  |  179.6 KB  |  2,568 lines

  1. "Data.app)@
  2. AReturns the character code of the first character of a$.
  3. For the Series 5, see Appendix D for the character set and for the Series 3c, see the character set in the back of the User Guide for the character codes. Alternatively, use A%=%char to find the code for char - e.g. %X for 'X'.
  4. If a$ is a null string ("") ASC returns the value 0.
  5. Example: A%=ASC("hello") returns 104, the code for h.
  6. ,BReturns the address at which variable is stored in memory.
  7. The values of different types of variables are stored in bytes starting at ADDR(variable). See PEEK for details.
  8. The maximum address is guaranteed to be less than 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.
  9. See SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, a& is guaranteed to fit into an integer.
  10. See UADD, USUB.
  11. ]ABegins a transaction on the current database. The purpose of this is to allow changes to a database to be committed in stages. Once a transaction has been started on a view (or table) then all database keywords will function as usual, but the changes to that view will not be made until COMMITTRANS is used.
  12. See also COMMITTRANS, ROLLBACK, INTRANS.
  13. #AReturns the character with character code x%.
  14. You can use it to display characters not easily available from the keyboard. For example, the instruction PRINT CHR$(133) displays an ellipsis (
  15. The full character set for the Series 5 is in Appendix D. For the Series 3c, see the User Guide.
  16. YACompacts the database file$, rewriting the file in place. All views on the database and the hence the file itself should be closed before calling this command. This should not be done to often since it uses considerable processor power.
  17. Compaction can also be done automatically on closing a file by setting the appropriate flag using SETFLAGS.
  18. pCOpens or closes a gap at off& (off%) within the allocated cell pcell& (pcell%), returning the new cell address or zero if out of memory. off& (off%) is 0 for the first byte in the cell. Opens a gap if the amount am& (am%) is positive, and closes it if negative.
  19. The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.
  20. Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.
  21. See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.
  22. See ALLOC. See also the 'Advanced Topics' chapter.
  23. ACloses the current view on a database. If there are no other views open on the database then the database itself will be closed. See SETFLAGS for details of how to set auto-compaction on closing files.
  24. If you've used ERASE to remove some records, CLOSE recovers the memory used by the deleted records, provided it is held either in the internal memory, on a memory disk (on the Series 5) or on a RAM SSD (on the Series 3c).
  25. <CPresents an alert - a simple dialog - with the messages and keys specified, and waits for a response. m1$ is the message to be displayed on the first line, and m2$ on the second line. If m2$ is not supplied or if it is a null string, the second message line is left blank.
  26. Up to three keys may be used. b1$, b2$ and b3$ are the strings (usually words) to use over the keys. b1$ appears over an Esc key, b2$ over Enter, and b3$ over Space. This means you can have Esc, or Esc and Enter, or Esc, Enter and Space keys. If no key strings are supplied, the word CONTINUE is used above an Esc key.
  27. The key number 1 for Esc, 2 for Enter or 3 for Space is returned.
  28. Constants for these return values are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  29. @AReturns the number of records in the current data file.
  30. This number will be 0 if the file is empty.
  31. If you try to count the number of records in a view while updating the view an 'Incompatible update mode' error will be raised (This will occur between assignment and APPEND / UPDATE or between MODIFY / INSERT and PUT).
  32. AThis converts days&, the number of days since 1/1/1900, to the corresponding date, returning the day of the month to day%, the month to month% and the year to year%. This is useful for converting the value set by dDATE,  which also gives days since 1/1/1900.
  33. BAllocates a cell on the heap of the specified size, returning the pointer to the cell or zero if there is not enough memory.
  34. The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.
  35. Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.
  36. See also SETFLAGS if you require the 64K limit to be enforced. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.
  37. See ADJUSTALLOC, REALLOC, FREEALLOC. See also the 'Advanced Topics' chapter.
  38. AReturns the number of seconds since 00:00 on 1/1/1970 at the date/time specified.
  39. Raises an error for dates before 1/1/1970.
  40. The value returned is an unsigned long integer. (Values up to +2147483647, which is 03:14:07 on 19/1/2038, are returned as expected. Those from +2147483648 upwards are returned as negative numbers, starting from -2147483648 and increasing towards zero.)
  41. See also SECSTODATE, HOUR, MINUTE, SECOND.
  42. Table1
  43. Name:
  44. Usage:
  45. 2Description:
  46. 3CBegins definition of an OPL application. caption is the application's name (or caption) in the machine's default language.  Note that although caption is a string, it is not enclosed in quotes.
  47. uid& is the application's UID. For distributed applications, official reserved UIDs must be used.  These can be obtained by contacting Psion Software plc (see the 'OPL applications' section in the 'Advanced Topics' chapter for details of how to do this).
  48. All information included in the APP
  49. ENDA structure will be used to generate an AIF file which specifies the applications caption in various languages, its icons for use on the System screen and its setting of FLAGS. See the 'Advanced Topics' chapter for further details of this.
  50. See CAPTION, ICON, FLAGS.
  51. See also the 'Advanced Topics' chapter for more details of OPAs.
  52. BReturns the current date and time from the system clock as a string - for example: "Fri 16 Oct 1992 16:25:30". The string returned always has this format - 3 mixed-case characters for the day, then a space, then 2 digits for the day of the month, and so on.
  53. Constants for offsets of each elements within the string (to be used with MID$, for example) are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it. The Date OPX provides a large set of procedures for manipulating dates and for accurate timing. See the 'Using OPXs on the Series 5' chapter for more details.
  54. / INSERT and PUT).
  55. ~DAdds a new record to the end of the current data file. The record which was current is unaffected. The new record, the last in the file, becomes the current record.
  56. The record added is made from the current values of the field variables A.field1$, A.field2$, and so on, of the current data file. If a field has not been assigned a value, zero will be assigned to it if it is a numeric field, or a null string if it is a string field.
  57. Example:
  58. PROC add:
  59. OPEN "address",A,f1$,f2$,f3$
  60. PRINT "ADD NEW RECORD"
  61. PRINT "Enter name:",
  62. INPUT A.f1$
  63. PRINT "Enter street:",
  64. INPUT A.f2$
  65. PRINT "Enter town:",
  66. INPUT A.f3$
  67. APPEND
  68. CLOSE
  69. To overwrite the current record with new field values, use UPDATE.
  70. On the Series 5, INSERT, PUT and CANCEL should be used in preference to APPEND and UPDATE, although APPEND and UPDATE are still supported for Series 3c compatibility. However, note that APPEND can generate a lot of extra (intermediate) erased records. COMPACT should be used to remove them, or alternatively use SETFLAGS to set auto-compaction on.
  71. See the 'Series 5 Database Handling' chapter for more details. See also INSERT, MODIFY, PUT, CANCEL, SETFLAGS.
  72. !DPositions the cursor at x% characters across the text window and y% rows down. AT 1,1 always moves to the top left corner of the window. Initially, the window is the full size of the screen, but you can change its size and position with the SCREEN command.
  73. A common use of AT is to display strings at particular positions in the text window. For example:
  74. AT 5,2 :PRINT "message".
  75. PRINT statements without an AT display at the left edge of the window on the line below the last PRINT statement (unless you use , or ;) and strings displayed at the top of the window eventually scroll off as more strings are displayed at the bottom of the window.
  76. Displayed strings always overwrite anything that is on the screen - they do not cause things below them on the screen to scroll down.
  77. Example:
  78. PROC records:
  79. LOCAL k%
  80. OPEN "clients",A,name$,tel$
  81. AT 1,7
  82. PRINT "Press a key to"
  83. PRINT "step to next record"
  84. PRINT "or Q to quit"
  85. AT 2,3 :PRINT A.name$
  86. AT 2,4 :PRINT A.tel$
  87. IF EOF
  88. AT 1,6 :PRINT "EndOfFile"
  89. FIRST
  90. ENDIF
  91. k%=GET
  92. UNTIL k%=%Q OR k%=%q
  93. CLOSE
  94. CSounds the buzzer. The beep lasts for time%/32 seconds so for a beep a second long make time%=32, etc. The maximum is 3840 (2 minutes).
  95. The pitch (frequency) of the beep is 512/(pitch%+1) KHz.
  96. BEEP 5,300 gives a comfortably pitched beep.
  97. If you make time% negative, BEEP first checks whether the sound system is in use (perhaps by another OPL program), and returns if it is. Otherwise, BEEP waits until the sound system is free.
  98. Example a scale from middle C:
  99. PROC scale:
  100. LOCAL freq,n%                REM n% relative to middle A
  101. n%=3                             REM start at middle C
  102. WHILE n%<16
  103. freq=440*2**(n%/12.0)             REM middle A = freq 440Hz
  104. BEEP 8,512000/freq-1.0
  105. n%=n%+1
  106. IF n%=4 OR n%=6 OR n%=9 OR n%=11 OR n%=13
  107. n%=n%+1
  108. ENDIF
  109. ENDWH
  110. Alternatively, sound the buzzer with this statement: PRINT CHR$(7). This produces a click sound.
  111. Note that on the Series 5 if your batteries are low BEEP may not produce the desired effect: the buzzer will be used instead to produce the 'beep'. The buzzer produces a higher pitched sound.
  112. CBUSY str$ displays str$ in the bottom left of the screen, until BUSY OFF is called. Use this to indicate 'Busy' messages, usually when an OPL program is going to be unresponsive to keypresses for a while.
  113. If c% is given, it controls the corner in which the message appears:
  114. c%            corner
  115. 0            top left
  116. 1            bottom left (default)
  117. 2            top right
  118. 3            bottom right
  119. Constants for these corner values are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  120. delay% specifies a delay time (in half seconds) before the message should be shown. Use this to prevent 'Busy' messages from continually appearing very briefly on the screen.
  121. Only one message can be shown at a time. The maximum string length of a BUSY message is 80 characters on the Series 5, and an 'Invalid argument' error is returned for any value in excess of this.  On the Series 3c, the maximum length is 19 characters.
  122. UFSpecifies an OPA's public name (or caption) for a particular language, which will appear below its icon on the Extras bar and in the list of 'Programs' in the 'New File' dialog (assuming the setting of FLAGS allows these) when the language is that used by the machine. CAPTION may only be used inside an APP...ENDA construct.
  123. The language code specifies for which language variant the caption should be used, so that the caption need not be changed when used on a different language machine. If used, for whatever language, CAPTION causes the default caption given in the APP declaration to be discarded. Therefore CAPTION statements must be supplied for every language in which the application is liable to be used, including the language of the machine on which the application is originally developed.
  124. The values of the language code should be one of the following:
  125. English 1    French 2     German 3    Spanish 4Italian 5    Swedish 6    Danish 7    Norwegian 8Finnish 9    American 10    Swiss-French 11    Swiss-German 12Portuguese 13    Turkish 14    Icelandic 15    Russian 16Hungarian 17    Dutch 18    Belgian-Flemish 19    Australian 20Belgian-French 21    Austrian 22    New Zealand 23    International French 24
  126. Constants for the language codes are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  127. The maximum length of caption$ is 255 characters. However, you should bear in mind that a caption longer than around 8 characters will not fit neatly below the application's icon on the Extras bar.
  128. See APP. See also the 'OPL applications' section in the 'Advanced Topics' chapter.
  129. .APPEND _data
  130. APPEND
  131. .ASC _string _conv
  132. a%=ASC(a$)
  133. .ASIN _math
  134. a=ASIN(x)
  135. Returns the arc sine, or inverse sine (SIN-1) of x.
  136. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.
  137. .AT _text
  138.     AT x%,y%
  139. .ATAN _math
  140. a=ATAN(x)
  141. Returns the arc tangent, or inverse tangent (TAN-1) of x.
  142. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.
  143. .BACK _data
  144. Makes the previous record in the current data file the current record.
  145. If the current record is the first record in the file, then the current record does not change.
  146. .BEEP
  147. BEEP time%,pitch%
  148. .BEGINTRANS _data
  149. BEGINTRANS
  150. .BOOKMARK _data
  151. b%=BOOKMARK
  152. Puts a bookmark at the current record of the current database view. The value returned can be used in GOTOMARK to make the record current again. Use KILLMARK to delete the bookmark.
  153. .BREAK _control
  154. BREAK
  155. Makes a program performing a DO...UNTIL or WHILE...ENDWH loop exit the loop and immediately execute the line following the UNTIL or ENDWH statement.
  156. .BUSY _gtext
  157. 4BUSY str$,c%,delay%
  158. BUSY str$,c%
  159. BUSY str$
  160. BUSY OFF
  161. .BYREF _mem
  162. BYREF variable
  163. Passes variable by reference to an OPX procedure when used in a procedure argument list.  This means that the value of the variable may be changed by the procedure.
  164. See the 'Using OPXs on the Series 5' chapter for more details.
  165. .CANCEL _data
  166. CANCEL
  167. fMarks the end of a database's INSERT or MODIFY phase and discards the changes made during that phase.
  168. .CAPTION _opa
  169. CAPTION caption$,languageCode%
  170. .CHR$ _string _conv
  171. a$=CHR$(x%)
  172. .CLEARFLAGS _opa _data
  173. CLEARFLAGS flags&
  174. wClears the flags given in flags& if they have previously been set by SETFLAGS, returning to the default.
  175. See SETFLAGS.
  176. @Returns the command-line arguments passed when starting a program. Null strings may be returned. x% should be from 1 to 3 for the Series 5 and may be up to 5 on the Series 3c. CMD$(2) to CMD$(5) are only for OPL applications.
  177. CMD$(1) returns the full path name used to start the running program.
  178. CMD$(2) returns the full path name of the file to be used by an OPL application. On the Series 5, if the CMD$(3)="R" (see below), a default filename, including path, is passed in CMD$(2).
  179. CMD$(3) returns "C" for "Create file" or "O" for "Open file" and may also return "R" on the Series 5. If the OPL application is being run with a new filename, this will return "C". This happens the very first time the OPL application is used, and whenever a new filename is used to run it. Otherwise, the OPA is being run with the name of an existing file, and CMD$(3) will return "O" if it is selected directly from the system screen. "R" (Series 5 only) is ret
  180. urned if your application has been run from the Program editor or has been selected via the Application's icon on the Extras bar, and not by the selection or creation of one of your documents from the system screen.
  181. Constants for the array elements (1-3) and for the return values of CMD$(3) are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  182. See the 'Advanced Topics' chapter for more details of OPL applications.
  183. See also GETCMD$.
  184. CDeclares constants which are treated as literals, not stored as data. The declarations must be made outside any procedure, usually at the beginning of the module. KConstantName has the normal type-specification indicators (%, &, $ or nothing for floating-point numbers). CONST values have global scope, and are not overridden by locals or globals with the same name: in fact the translator will not allow the declaration of locals or globals of the same name. By convention, all constants should be named with a leading K to distinguish them from variables.
  185. It should be noted that it is not possible to define constants with values -32768 (for integers) and 214748648 (for long integers) in decimals, but hexadecimal notation may be used instead (i.e. values of $8000 and &80000000 respectively).
  186. BCopies the file src$, which may be of any type, to the file dest$. Any existing file with the name dest$ is deleted. You can copy across devices.  On the Series 3c you can use the appropriate file extensions to indicate the type of file, and on all machines use wildcards if you wish to copy more than one file at a time.
  187. If src$ contains wildcards, dest$ may specify either a filename similarly containing wildcards or just the device and directory to which the files are to be copied under their original names.
  188. Example: To copy all the files from internal memory (in \OPL) to D:\ME\:
  189. COPY "C:\OPL\*","D:\ME\"
  190. (Remember the final backslash on the directory name.)
  191. There are more details of full file specifications in the 'Advanced topics' chapter.
  192. GGCreates a table in a database. The database is also created if necessary. Immediately after calling CREATE, the file and view (or table) is open and ready for access.
  193. tableSpec$ contains the database filename and optionally a table name and the field names to be created within that table.  For example:
  194. CREATE "clients FIELDS name(40), tel TO phone", D, n$, t$
  195. The filename is clients. The table to be created within the file is phone. The comma-separated list, between the keywords FIELDS and  TO, specifies the field names whose types are specified by the field handles (i.e. n$, t$).
  196. The name field has a length of 40 bytes, as specified within the brackets that follow it. The tel field has the default length of 255 bytes. This mechanism is necessary for creating some indexes. See the 'Using OPXs on the Series 5' chapter for more details on index creation.
  197. The filename may be a full file specification of up to 255 characters. A field name may be up to a maximum of  64 characters long. Text fields have a default length of 255 bytes.
  198. log specifies the logical file name A to Z. This is used as an abbreviation for the file name when you use other data file commands such as USE.
  199. Compatibility with the Series 3c
  200. As on the Series 3c, the table specification may contain just the filename. In this case the table name will default to Table1 and the field names will be derived from the handles: "$" replaced by "s",  "%" by "i", and "&" by "a". E.g. n$ becomes ns. Knowing this allow views to be opened on tables (called Table1) that were created with the OPL16 method. However, it would be better to create the fields with proper names in the first place.
  201. For example:
  202. CREATE "clients",A,n$,t%,d&
  203. is a short version of
  204. CREATE "clients FIELDS ns,ti,da TO Table1",A,n$,t%,d&
  205. both creating Table1. Database clients is also created if it does not yet exist.
  206. DCURSOR ON switches the text cursor on at the current cursor position. Initially, no cursor is displayed.
  207. You can switch on a graphics cursor in a window by following CURSOR with the ID of the window. This replaces any text cursor. At the same time, you can also specify the cursor's shape, and its position relative to the baseline of text.
  208. asc% is the ascent - the number of pixels (-128 to 127) by which the top of the cursor should be above the baseline of the current font. h% and w% (both from 0 to 255) are the cursor's height and width.
  209. If you do not specify them, the following default values are used:
  210. asc%    font ascent
  211. h%    font height
  212. If type% is given, it can have these effects:
  213. 2     not flashing
  214. 4    grey
  215. You can add these values together to combine effects - if type% is 6 a grey non-flashing cursor is drawn.  The Series 3c also supports an obloid cursor by specifying a type% of 1.  Using type%=1 on the Series 5 just displays a default graphics cursor, as though no type had been specified.
  216. Constants for these types are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  217. An error is raised if id% specifies a bitmap rather than a window.
  218. CURSOR OFF switches off any cursor.
  219. AConverts x%, a number from 1 to 7, to the day of the week, expressed as a three letter string. E.g. d$=DAYNAME$(1) returns MON.
  220. Example:
  221. PROC Birthday:
  222. LOCAL d&,m&,y&,dWk%
  223. dINIT
  224. dTEXT "","Date of birth",2
  225. dTEXT "","eg 23 12 1963",$202
  226. dLONG d&,"Day",1,31
  227. dLONG m&,"Month",1,12
  228. dLONG y&,"Year",1900,2155
  229. IF DIALOG=0 :BREAK :ENDIF
  230. dWk%=DOW(d&,m&,y&)
  231. CLS :PRINT DAYNAME$(dWk%),
  232. PRINT d&,m&,y&
  233. dINIT dTEXT "","Again?",$202
  234. dBUTTONS "No",%N,"Yes",%Y
  235. UNTIL DIALOG<>%y
  236. See also DOW.
  237. >BReturns the number of days since 1/1/1900.
  238. Use this to find out the number of days between two dates.
  239. Example:
  240. PROC deadline:
  241. LOCAL a%,b%,c%,deadlin&
  242. LOCAL today&,togo%
  243. PRINT "What day? (1-31)"
  244. INPUT a%
  245. PRINT "What month? (1-12)"
  246. INPUT b%
  247. PRINT "What year? (19??)"
  248. INPUT c%
  249. deadlin&=DAYS(a%,b%,1900+c%)
  250. today&=DAYS(DAY,MONTH,YEAR)
  251. togo%=deadlin&-today&
  252. PRINT togo%,"days to go"
  253. See also dDATE, SECSTODATE.
  254. The Date OPX provides a large set of procedures for manipulating dates and for accurate timing. See the 'Using OPXs on the Series 5' chapter for more details.
  255. ACreates a dialog checkbox entry. This is similar to a choice list with two items, except that the list is replaced by a checkbox with the tick either on or off. The state of the checkbox is maintained across calls to the dialog.
  256. Initially you should set the live variable chk% to 0 to set the tick symbol off and to any other value to set it on. chk% is then automatically set to 0 if the box is unchecked or -1 if it is checked when the dialog is closed.
  257. See also dINIT.
  258. See also DOW.
  259. .CLOSE _data
  260. CLOSE
  261. .CLS _text
  262. Clears the contents of the text window.
  263. The cursor then goes to the beginning of the top line. If you have used CURSOR OFF the cursor is still positioned there, but is not displayed.
  264. .CMD$ _opa
  265. c$=CMD$(x%)
  266. .COMMITTRANS _data
  267. COMMITTRANS
  268. UCommits the transaction on the current view.
  269. See also BEGINTRANS, ROLLBACK, INTRANS.
  270. .COMPACT _data
  271. COMPACT file$
  272. .CONTINUE _control
  273.     CONTINUE
  274. Makes a program immediately go to the UNTIL... line of a DO...UNTIL loop or the WHILE... line of a WHILE...ENDWH loop i.e. to the test condition.
  275. Example:
  276. See also BREAK.
  277. .CONST _mem
  278. "CONST KConstantName=constantValue
  279. .COPY _file
  280. COPY src$,dest$
  281. .COS _math
  282.     c=COS(x)
  283. sReturns the cosine of x, where x is an angle in radians.
  284. To convert from degrees to radians, use the RAD function.
  285. .COUNT _data
  286.     c%=COUNT
  287. .CREATE _data
  288.  CREATE tableSpec$,log,f1,f2,...
  289. .CURSOR _text _gtext
  290. RCURSOR ON
  291. CURSOR OFF
  292. CURSOR id%,asc%,w%,h%
  293. CURSOR id%,asc%,w%,h%,type%
  294. CURSOR id%
  295. .DATETOSECS _date _time
  296. 's&=DATETOSECS(yr%,mo%,dy%,hr%,mn%,sc%)
  297. .DATIM$ _date _time
  298. d$=DATIM$
  299. .DAY _date
  300. d%=DAY
  301. FReturns the current day of the month (1 to 31) from the system clock.
  302. .DAYNAME$ _date
  303. d$=DAYNAME$(x%)
  304. BDefines an edit box for a date, to go in a dialog.
  305. p$ will be displayed on the left side of the line.
  306. lg&, which must be a LOCAL or a GLOBAL variable, specifies the date to be shown initially. Although it will appear on the screen like a normal date, for example 15/03/92, lg& must be specified as "days since 1/1/1900".
  307. min& and max& give the minimum and maximum values which are to be allowed. Again, these are in days since 1/1/1900. An error is raised if min& is higher than max&.
  308. When you finish using the dialog, the date you entered is returned in lg&, in days since 1/1/1900.
  309. The system setting determines whether years, months or days are displayed first.
  310. See also DAYS, SECSTODATE,DAYSTODATE, dINIT.
  311. Table1
  312. ColA9
  313. ColB9
  314. ColA10
  315. ColB10
  316. ColA11
  317. ColB11
  318. DATE,  which also gives days since 1/1/1900.
  319. JThe Series 5 allows more than 3 buttons which may be added in the same way.
  320. Defines exit keys to go at the bottom (or the side on the Series 5: see dINIT) of a dialog.
  321. From one to three (or more on the Series 5) exit keys may be defined. Each pair of p$ and k% specifies an exit key; p$ is the text to be displayed on it (above it on the Series 3c), while k% is the keycode of the shortcut key. DIALOG returns the keycode of the key pressed (in lower case for letters).
  322. For alphabetic keys, use the % sign - %A means 'the code of A', and so on. The shortcut key is then Ctrl+alphabetic key on the Series 5, but just the alphabetic key without a modifier on the Series 3c. An appendix lists the codes for keys (such as Tab) which are not part of the character set. If you use the code for one of these keys, its name (e.g. 'Tab', or 'Enter') will be shown in the key.
  323. On the Series 5, the following effects may be obtained by adding the appropriate constants to the shortcut key keycode:
  324. effect                                constant value
  325. display a button with no shortcut key label underneath it            256 ($100)
  326. use the key alone (without the Ctrl modification) as the shortcut key     512 ($200)
  327. Constants for these flags and keycodes for Esc and other keys are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  328. If you use a negative value for a k% argument, that key is a 'Cancel' key. The corresponding positive value is used for the key to display and the value for DIALOG to return, but if you do press this key to exit, the var variables used in the commands like dEDIT, dTIME etc. will not be set. For the Series 5, when using a negative shortcut to specify the cancel button, you must negate the shortcut together with any added flags.
  329. The Esc key will always cancel a dialog box, with DIALOG returning 0. If you want to show the Esc key as one of the exit keys, use -27 as the k% argument (its keycode is 27) so that the var variables will not be set if Esc is pressed.
  330. There can be only one dBUTTONS item per dialog.
  331. The buttons take up two lines on the screen. dBUTTONS may be used anywhere between dINIT and DIALOG; the postion of its use does not affect the position of the buttons in the dialog.
  332. Some keypresses cannot be specified, for example, those using the Control key for the Series 3c.
  333. This example presents a simple query, returning 'False' for No, or 'True' for Yes, providing shortcut keys of N and Y respectively and without labels beneath the keys.
  334. PROC query:
  335. dINIT
  336. dTEXT "","FORGET CHANGES",2
  337. dTEXT "","Sure?",$202
  338. dBUTTONS "No",-(%N OR $100 OR $200),"Yes",%Y OR $100 OR $200
  339. RETURN DIALOG=%y
  340. See also dINIT.
  341. ADefines an edit box for a floating-point number, to go in a dialog.
  342. p$ will be displayed on the left side of the line.
  343. min and max give the minimum and maximum values which are to be allowed. An error is raised if min is higher than max.
  344. fp must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in fp.
  345. See also dINIT.
  346. is checked when the dialog is closed.
  347. See also dINIT.
  348. DDefines a choice list to go in a dialog.
  349. p$ will be displayed on the left side of the line. list$ should contain the possible choices, separated by commas - for example, "No,Yes". One of these will be displayed on the right side of the line, and ( ( can be used to move between the choices.
  350. choice% must be a LOCAL or a GLOBAL variable. It specifies which choice should initially be shown 
  351.  1 for the first choice, 2 for the second, and so on. When you finish using the dialog, choice% is given a value indicating which choice was selected 
  352.  again, 1 for the first choice, and so on.
  353. On the Series 5, dCHOICE supports an unrestricted number of items (up to memory limits).  To extend a dCHOICE list, add a comma after the last item on the line followed by "..." (three full-stops), as shown in the usage above. choice% must be the same on all the lines, otherwise an error is raised.  For example, the following specifies items i1, i2, i3, i4, i5, i6:
  354. dCHOICE ch%,prompt$,"i1,i2,..."
  355. dCHOICE ch%,"","i3,14,..."
  356. dCHOICE ch%,"","i5,i6"
  357. See also dINIT.
  358. BDefines a string edit box, to go in a dialog.
  359. p$ will be displayed on the left side of the line.
  360. str$ is the string variable to edit. Its initial contents will appear in the dialog. The length used when str$ was defined is the maximum length you can type in.
  361. len%, if supplied, gives the width of the edit box (allowing for widest possible character in the font). The string will scroll inside the edit box, if necessary. If len% is not supplied, the edit box is made wide enough for the maximum width str$ could possibly be.
  362. See also dTEXT.
  363. eturned in lg&, in days since 1/1/1900.
  364. The system setting determines whether years, months or days are displayed first.
  365. See also DAYS, SECSTODATE,DAYSTODATE, dINIT.
  366. BCauses the translator to report an error if any variables or procedures are used before they are declared. It should be used at the beginning of the module to which it applies, before the first procedure. It is useful for detecting 'Undefined externals' errors at translate-time rather than at runtime.
  367. For example, with DECLARE EXTERNAL commented out, the following translates and raises the error, 'Undefined
  368. externals, i' at runtime. Adding the declaration causes the error to be detected at translate-time instead.
  369. REM DECLARE EXTERNAL
  370. PROC main:
  371. LOCAL i%
  372. i%=10
  373. PRINT i
  374. If you use this declaration, you will need to declare all subsequent variables and procedures used in the module, using EXTERNAL.
  375. See also EXTERNAL.
  376. AConverts from radians to degrees.
  377. Returns x, an angle in radians, as a number of degrees. The formula used is: 180*x/PI
  378. All the trigonometric functions (SIN,COS etc.) work in radians, not degrees. You can use DEG to convert an angle returned by a trigonometric function back to degrees:
  379. Example:
  380. PROC xarctan:
  381. LOCAL arg,angle
  382. PRINT "Enter argument:";
  383. INPUT arg
  384. PRINT "ARCTAN of",arg,"is"
  385. angle=ATAN(arg)
  386. PRINT angle,"radians"
  387. PRINT DEG(angle),"degrees"
  388. To convert from degrees to radians, use RAD.
  389. uld possibly be.
  390. See also dTEXT.
  391. @Defines a multi-line edit box to go into a dialog. Normally the resulting text would be used in a subsequent dialog, saved to file or printed using the Printer OPX (see the 'Using OPXs on the Series 5' chapter). It is also possible to paste text into the buffer from other applications and vice versa, although any formatting or embedded objects contained in text pasted in will be removed.
  392. ptrData& is the address of a buffer to take the edited data. It could be the address of an array as returned by ADDR, or of a heap cell, as returned by ALLOC (see ADDR and ALLOC).  The buffer may not be specified directly as a string and may not be read as such.  Instead it should be peeked, byte by byte (see PEEK).  The leading 4 bytes at ptrData& contain the initial number of bytes of data following. These bytes are also set by dEDITMULTI to the actual number of bytes edited. For this reason it is convenient to use a long integer array as the buffer, with at least 1+(maxLength%+3)/4 elements. The first element of the array then specifies the initial length.
  393. If an allocated cell is used (probably because more than 64K is required), the first 4 bytes of the cell must be set to the initial length of the data. If this
  394.  length is not set then an error will be raised. For example if a cell of 100000 bytes is allocated, you would need to poke a zero long integer in the start to specify that there is initially no text in the cell. For example:
  395. p&=ALLOC(100000)
  396. POKEL p&,0        REM Text starts at p&+4
  397. Special characters such as line breaks and tab characters may appear in the buffer. Constants for the codes of these are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  398. The prompt, p$ will be displayed on the left side of the edit box.  widthInChars% specifies the width of the edit box within which the text is wrapped, using a notional average character width.  The actual number of characters that will fit depends on the character widths, with e.g. more 'i's fitting than 'w's.  numberLines% specifies the number of full lines displayed. Any more lines will be scrolled. maxLength% specifies the length in bytes of the buffer provided (excluding the bytes used to store the length).
  399. The Enter key is used by a multi-line edit box which has the focus before being offered to any buttons. This means that Enter can't be used to exit the dialog, unless another item is provided that can take the focus without using the Enter key.  Normal practice is to provide a button that does not use the Enter key to exit a dialog whenever it contains a multi-line edit box. The Esc key will always cancel a dialog however, even when it contains a multi-line edit box.
  400. The following example presents a three-line edit box which is about 10 characters wide and allows up to 399 characters:
  401. CONST KLenBuffer%=399
  402. PROC dEditM:
  403. LOCAL buffer&(101)    REM 101=1+(399+3)/4 in integer arithmetic
  404. LOCAL pLen&,pText&
  405. LOCAL i%
  406. LOCAL c%
  407. pLen&=ADDR(buffer&(1))
  408. pText&=ADDR(buffer&(2))
  409. WHILE 1
  410. dINIT "Try dEditMulti"
  411. dEDITMULTI pLen&,"Prompt",10,3,KLenBuffer%
  412. dBUTTONS "Done",%d            REM button needed to exit dialog
  413.   IF DIALOG=0 :BREAK :ENDIF
  414.   PRINT "Length:";buffer&(1)
  415.   PRINT "Text:"
  416.   i%=0
  417.   WHILE i%<buffer&(1)
  418. c%=PEEKB(pText&+i%)
  419. IF c%>=32
  420. PRINT CHR$(c%);
  421. PRINT ".";    REM just print a dot for special characters
  422. ENDIF
  423. i%=i%+1
  424.   ENDWH
  425. ENDWH
  426. See also dINIT.
  427. DChange the default window (ID=1) to enable or disable the use of grey (on the Series 3c) or change the colour mode (on the Series 5).
  428. The default window uses 4-colour mode initially.
  429. mode%=1 just clears the screen, leaving the window in 4-colour mode. Clearing of the screen ensures compatibility with Series 3c (see above).  mode% of 0 changes the screen to 2-colour mode (actually results in a mapping of greys to white or black) and mode% of 2 changes to 16-colour mode, as expected.
  430. Using DEFAULTWIN with either of these values also clears the screen.
  431. Using 4-colour mode uses more power than using 2-colour mode and using 16-colour mode uses more power that either of these. See the 'Graphics' chapter for more information.
  432. Constants for the modes of DEFAULTWIN are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and see Appendix E for a listing of it.
  433. You are advised to call DEFAULTWIN once and for all near the start of your program if you need to change the colour mode of the default window on the Series 5 or use grey on the Series 3c. If it fails with 'Out of memory' error, the program can then exit cleanly without losing vital information.
  434. See also gGREY, gCOLOR, gCREATE.
  435. ADefines an edit box for a long integer, to go in a dialog.
  436. p$ will be displayed on the left side of the line.
  437. min& and max& give the minimum and maximum values which are to be allowed. An error is raised if min& is higher than max&.
  438. lg& must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in lg&.
  439. See also dINIT.
  440. ,"radians"
  441. PRINT DEG(angle),"degrees"
  442. To convert from degrees to radians, use RAD.
  443. ODefines a filename edit box or selector, to go in a dialog. A 'Folder' and 'Disk' selector are automatically added on the following lines (on the Series 3c, a 'Disk' selector only).
  444. By default no prompts are displayed for the file, folder and disk selectors on the Series 5. A comma-separated prompt list should be supplied. For example, for a filename editor with the standard prompts use:
  445. dFILE f$,"File,Folder,Disk",1
  446. f% controls the type of file editor or selector, and the kind of input allowed. You can add together any of the following values:
  447.      value            meaning
  448.     0            use a selector
  449.     1            use an edit box
  450.     2            allow directory names
  451.     4             directory names only
  452.     8            disallow existing files
  453.     16            query existing files
  454.     32            allow null string input
  455.     128            obey/allow wildcards
  456.       256              allow ROM files to be selected
  457.     512            allow files in the System folder to be selected
  458. The first of the list is the most crucial. If you add 1 into f%, you will see a file edit box, as when creating a new file. If you do not add 1, you will see the 'matching file' selector, used when choosing an existing file.
  459. The value 64 (to omit file extensions) is not valid on the Series 5 since file extensions are no longer treated as special components of the filename.
  460. If performing a 'copy to' operation, you might use 1+2+16, to specify a file edit box, in which you can type the name of a directory to copy to, and which will produce a query if you type the name of an existing file.
  461. If asking for the name of a directory to remove, you might use 4, to allow an existing directory name only.
  462. 'Query existing' is ignored if 'disallow existing' is set. These two, as well as 'allow null string input', only work with file edit boxes, not 'matching file' selectors.
  463. For file selectors, dFILE supports file restriction by UID, or by type from the user's point of view. Documents are identified by three UIDs which identify which application created the document and what kind of file it is. Specifying all three UIDs will restrict the files as much as is possible, and specifying fewer will provide less restriction. You can supply 0 for uid1& and uid2& if you only want to restrict the list to uid3&. This may be useful when dealing with documents from one of your own applications: you can easily find out the third UID as it will be the UID you specified in the APP statement. Note that UIDs are ignored for editors.  For example, if your application has UID KUidMyApp&, then the following will list only your applicationspecific documents:
  464. dFILE f$,p$,f%,0,KUidOplDoc&,KUidMyApp&
  465. REM KUidOplDoc& for OPL docs
  466. Some OPL-related UIDs are given in Const.oph. See the 'Calling Procedures' for details of how to use this file and Appendix E for a listing of it.
  467. file$ is the string variable to edit. Its initial contents always control the initial drive and directory used. Any filename part of file$ is shown initially in the filename box. For a 'matching file' selector, you can use wildcards in the filename part (such as *.tmp) to control which filenames are matched. To do this, you must add 128 to f%. 128 also allows wildcard specifications to be entered (returned in str$), for both 'matching' and 'new file' selectors.
  468. With a matching file selector (as opposed to an edit box) the value 8 restricts the selection to files which match the filename/extension in file$.
  469. You can always press Tab to produce the full file selector with a dFILE item.
  470. file$ must be declared to be 255 bytes long, since file names may be up to this length, and if it is shorter an error will be raised. On the Series 3c, it must be at least 128 bytes long.
  471. Constants for the flags used by dFILE and for some OPL-related UIDs are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  472. See also dINIT.
  473. =AReturns the error message for the specified error code x%.
  474. ERR$(ERR) gives the message for the last error which occurred. Example:
  475. TRAP OPEN "\FILE",A,field1$
  476. IF ERR
  477. PRINT ERR$(ERR)
  478. RETURN
  479. ENDIF
  480. See also ERR, ERRX$. See the 'Error Handling' chapter for full details, including the list of error numbers and messages.
  481. ally. When you finish using the dialog, the value you entered is returned in fp.
  482. See also dINIT.
  483. bBPresents the dialog prepared by dINIT and commands such as dTEXT and dCHOICE. If you complete the dialog by pressing Enter, your settings are stored in the variables specified in dLONG, dCHOICE etc., although you can prevent this with dBUTTONS.
  484. If you used dBUTTONS when preparing the dialog, the keycode which ended the dialog is returned. Otherwise, DIALOG returns the line number of the item which was current when Enter was pressed. The top item (or the title line, if present), has line number 1.
  485. If you cancel the dialog by pressing Esc, the variables are not changed, and 0 is returned.
  486. See also dINIT.
  487. .DAYS _date
  488. d&=DAYS(day%,month%,year%)
  489. .DAYSTODATE _date
  490. #DAYSTODATE days&,year%,month%,day%
  491. .dBUTTONS _dialog
  492. KdBUTTONS p1$,k1%,p2$,k2%,p3$,k3%
  493. dBUTTONS p1$,k1%,p2$,k2%
  494. dBUTTONS p1$,k1%
  495. .dCHECKBOX _dialog
  496. dCHECKBOX ck%,prompt$
  497. .dCHOICE _dialog
  498. dCHOICE var choice%,p$,list$
  499. dCHOICE var choice%,p$,list1$+",..."
  500. dCHOICE var choice%,"",list2$+",..."
  501.    ...
  502. dCHOICE var choice%,"",listN$
  503. .dDATE _dialog _date
  504. dDATE var lg&,p$,min&,max&
  505. .DECLARE EXTERNAL _mem
  506. DECLARE EXTERNAL
  507. .dEDIT _dialog
  508. )dEDIT var str$,p$,len%
  509. dEDIT var str$,p$
  510. .dEDITMULTI _dialog
  511. AdEDITMULTI var ptrData&,p$,widthInChars%,numberLines%,maxLength%
  512. .DEFAULTWIN _win
  513. DEFAULTWIN mode%
  514. .DEG _math
  515.     d=DEG(x)
  516. .DELETE _file
  517. DELETE filename$
  518. qDeletes any type of file.
  519. You can use wildcards for example, to delete all the files in D:\OPL
  520. DELETE "D:\OPL\*"
  521. .DELETE _data
  522. DELETE dbase$,table$
  523. This deletes the table, table$, from the database, dbase$. To do this all views of the database, and hence the database itself, must be closed.
  524. .dFILE _dialog
  525. >dFILE var file$,p$,f%
  526. dFILE var file$,p$,f%,uid1&,uid2&,uid3&
  527. .dFLOAT _dialog
  528. dFLOAT var fp,p$,min,max
  529. .DIALOG  _dialog
  530. n%=DIALOG
  531. EPrepares for definition of a dialog, cancelling any existing one. Use dTEXT, dCHOICE etc. to define each item in the dialog, then DIALOG to display the dialog.
  532. If title$ is supplied, it will be displayed at the top of the dialog.
  533. Any supplied title$ will be positioned in a grey box at the top of the dialog.
  534. flags% can be any added combination of the following constants to achieve the following effects,
  535. effect                        value
  536. buttons on the right rather than at the bottom        1
  537. no title bar (any title in dINIT is ignored)        2
  538. use the full screen                    4
  539. don't allow the dialog box to be dragged        8
  540. pack the dialog densely (not buttons though)        16
  541. Constants for these flags are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  542. It should be noted that dialogs without titles cannot be dragged regardless of the 'No
  543. drag' setting. Dense packing enables more lines to fit on the screen for larger dialogs.
  544. On the Series 5, if an error occurs when adding an item to a dialog, the dialog is deleted and dINIT needs calling again. This is necessary to avoid having partially specified dialog lines.
  545. In practical terms, this means that where the following artificial example would work on the Series 3c, giving just a long integer editor, it will raise a 'Structure fault' error on the Series 5.
  546. dINIT
  547. ONERR e1
  548. REM bad arg list gives argument error
  549. dCHOICE ch%,"ChList","a,b,,,,c"
  550. ONERR OFF
  551. dLONG l&,"Long",0,12345
  552. DIALOG
  553. BLists filenames, including subdirectory names, matching a file specification. You can include wildcards in the file specification. If filespec$ is just a directory name, include the final backslash on the end for example, "\TEMP\" . Use the function like this:
  554. DIR$(filespec$) returns the name of the first file matching the file specification.
  555. DIR$("") then returns the name of the second file in the directory.
  556. DIR$("") again returns the third, and so on.
  557. When there are no more matching files in the directory, DIR$("") returns a null string.
  558. Example, listing all the files whose names begin with A in C:\ME\
  559. PROC dir:
  560. LOCAL d$(255)
  561. d$=DIR$("C:\ME\A*")
  562. WHILE d$<>""
  563. PRINT d$
  564. d$=DIR$("")
  565. ENDWH
  566. AFinds out whether you're at the end of a file yet.
  567. Returns -1 (true) if the end of the file has been reached, or 0 (false) if it hasn't.
  568. When reading records from a file, you should test whether there are still records left to read, otherwise you may get an error.
  569. Example:
  570. PROC eoftest:
  571. OPEN "myfile",A,a$,b%
  572. PRINT A.a$
  573. PRINT A.b%
  574. PAUSE -40
  575. UNTIL EOF
  576. PRINT "The last record"
  577. RETURN
  578. lso dINIT.
  579. ;BDO forces the set of statements which follow it to execute repeatedly until the condition specified by UNTIL is met.
  580. This is the easiest way to repeat an operation a certain number of times.
  581. Every DO must have its matching UNTIL to end the loop.
  582. If you set a condition which is never met, the program will go round and round, locked in the loop forever.
  583. You can escape by pressing Ctrl+Esc, provided you haven't set ESCAPE OFF. If you have set ESCAPE OFF, you will have to return to go to the Task list, select your program in the list and click the 'Close file' option.
  584. APositions a dialog. Use dPOSITION at any time between dINIT and DIALOG.
  585. dPOSITION uses two integer values. The first specifies the horizontal position, and the second, the vertical. dPOSITION -1,-1 positions to the top left of the screen; dPOSITION 1,1 to the bottom right; dPOSITION 0,0 to the centre, the usual position for dialogs.
  586. dPOSITION 1,0, for example, positions to the right-hand edge of the screen, and centres the dialog half way up the screen.
  587. See also dINIT.
  588. EDefines a line of text to be displayed in a dialog.
  589. p$ will be displayed on the left side of the line, and body$ on the right side. If you only want to display a single string, use a null string ("") for p$, and pass the desired string in body$. It will then have the whole width of the dialog to itself. An error is raised if body$ is a null string.
  590. body$ is normally displayed left aligned (although usually in the right column). You can override this by specifying t%:
  591. t%        effect
  592. 0        left align body$
  593. 1        right align body$
  594. 2         centre body$
  595. However, note that on the Series 5, alignment of body$ is only supported when p$ is null, with the body being left aligned otherwise. In addition, you can add any or all of the following three values to t%, for these effects:
  596. $800        specify this item as a text separator
  597. Note that on the Series 5, bold dialog text is not supported. You can display a line separator between any dialog items by setting the flag $800 on an item which has null p$ and body$. (If p$ and/or body$ are not null, then the flag is ignored and no separator is drawn.)  The separator counts as an item in the value returned by DIALOG. On the Series 3c, only one line can be drawn across a dialog using the flag $200. It will be below the last item which asks for it, whether the title from dINIT (Series 3c only) or a dTEXT item. The flag $400 only allows the prompt, and not the body, to be selected.
  598. See also dEDIT, dINIT
  599. BDefines a secret string edit box, such as for a password, to go in a dialog.
  600. p$ will be displayed on the left side of the line.
  601. str$ is the string variable to take the string you type.
  602. !    str$ must be less than 16 characters long on the Series 5 and must be at least eight characters long on the Series 3c.
  603. Initially the dialog does not show any characters for the string; the initial contents of str$ are ignored. A special symbol will be displayed for each character you type, to preserve the secrecy of the string.
  604. See also dINIT.
  605. hAChecks to see that a file exists.
  606. Returns -1 ('True') if the file exists and 0 ('False') if it doesn't.
  607. Use this function when creating a file to check that a file of the same name does not already exist, or when opening a file to check that it has already been created:
  608. IF NOT EXIST("CLIENTS")
  609. CREATE "CLIENTS",A,names$
  610. OPEN "CLIENTS",A,names$
  611. ENDIF
  612. @Defines an edit box for a time, to go in a dialog.
  613. p$ will be displayed on the left side of the line.
  614. lg&, which must be a LOCAL or a GLOBAL variable, specifies the time to be shown initially. Although
  615.  it will appear on the screen like a normal time, for example 18:27, lg& must be specified as seconds after 00:00. A value of 60 means one minute past midnight; 3600 means one o'clock, and so on.
  616. min& and max& give the minimum and maximum values which are to be allowed. Again, these are in seconds after 00:00. An error is raised if min& is higher than max&.
  617. When you finish using the dialog, the time you entered is returned in lg&, in seconds after 00:00.
  618. t% specifies the type of display required, as follows:
  619. t%        time display
  620. 0        absolute time no seconds
  621. 1        absolute time with seconds
  622. 2        duration no seconds
  623. 3        duration with seconds
  624. 4         time without hours
  625. 8        absolute time in 24 hour clock
  626. For example, 03:45 represents an absolute time while 3 hours 45 minutes represents a duration.
  627. Absolute times are displayed in 24-hour or am/pm format according to the current system setting. 8 displays the time in 24 hour clock, regardless of the system setting on the Series 5.
  628. Absolute times always display am or pm as appropriate, unless 24 hour clock is being used.  Durations never display am or pm.  Note, however, that if you use the flag  4 (no hours) then the am/pm symbol will be displayed and the flag 2 must be added if you wish to hide it.
  629. See also dINIT.
  630. tCDisplays a string variable which you can edit directly on the screen. All the usual editing keys are available the arrow keys move along the line, Esc clears the line, and so on.
  631. When you have finished editing, press Enter to confirm the changes. If you press Enter before you have made any changes, then the string will be unaltered.
  632. If you use EDIT in conjunction with a PRINT statement, use a comma at the end of the PRINT statement, so that the string to be edited appears on the same line as the displayed string:
  633. PRINT "Edit address:",
  634. EDIT A.address$
  635. UPDATE
  636. TRAP EDIT _text
  637. If the Esc key is pressed while no text is on the input line, the 'Escape key pressed' error (number 114) will be returned by ERR provided that the EDIT has been trapped. You can use this feature to enable the user to press the Esc key to escape from inputting a string.
  638. See also INPUT, dEDIT.
  639. ~AConverts an integer expression (either integer or long integer) into a floating-point number. Example:
  640. PROC gamma:(v)
  641. LOCAL c
  642. c=3E8
  643. RETURN 1/SQR(1-(v*v)/(c*c))
  644. You could call this procedure like this: gamma:(FLT(a%)) if you wanted to pass it the value of an integer variable without having first to assign the integer value to a floating-point variable.
  645. See also INT and INTF.
  646. RETURN
  647. AReturns the number of the last error which occurred, or 0 if there has been no error.
  648. Example:
  649. PRINT "Enter age in years"
  650. age::
  651. TRAP INPUT age%
  652. IF ERR=-1
  653. PRINT "Number please:"
  654. GOTO age
  655. ENDIF
  656. You can set the value returned by ERR to 0 (or any other value) by using TRAP RAISE 0. This is useful for clearing ERR.
  657. See also ERR$,ERRX$. See the 'Error Handling' chapter for full details, including the list of error numbers and messages.
  658. AReturns the current extended error message (when an error has been trapped), e.g.
  659. 'Error in MODULE\PROCEDURE,EXTERN1,EXTERN2,...'
  660. which would have been presented as an alert if the error had not been trapped. This allows the list of missing externals, missing procedure names, etc. to be found when an error has been trapped by a handler.
  661. See ERR, ERR$. See the 'Error Handling' chapter for full details, including the list of error numbers and messages.
  662. BESCAPE OFF stops Ctrl+Esc on the Series 5 or Psion-Esc on the Series 3c being used to break out of the program when it is running. ESCAPE ON enables this feature again.
  663. ESCAPE OFF takes effect only in the procedure in which it occurs, and in any sub-procedures that are called. Ctrl+Esc or Psion-Esc is always enabled when a program begins running.
  664. If your program enters a loop which has no logical exit, and ESCAPE OFF has been used, you will have to go to the Task list, move to the program name, and select the 'Close file' option.
  665. \vp`>B
  666. <HDb[
  667. .dINIT _dialog
  668. 'dINIT
  669. dINIT title$
  670. dINIT title$,flags%
  671. .DIR$ _file
  672. $d$=DIR$(filespec$)
  673. then    d$=DIR$("")
  674. .dLONG _dialog
  675. dLONG var lg&,p$,min&,max&
  676. .DO...UNTIL _control
  677. statement
  678. UNTIL condition
  679. .DOW _date
  680. d%=DOW(day%,month%,year%)
  681. Returns the day of the week from 1 (Monday) to 7 (Sunday) given the date.
  682. day% must be between 1 and 31, month% from 1 to 12 and year% from 1900 to 2155.
  683. For example, D%=DOW(4,7,1992) returns 6, meaning Saturday.
  684. .dPOSITION _dialog
  685. dPOSITION x%,y%
  686. .dTEXT _dialog
  687. !dTEXT p$,body$,t%
  688. dTEXT p$,body$
  689. .dTIME _dialog
  690. dTIME var lg&,p$,t%,min&,max&
  691. .dXINPUT _dialog
  692. dXINPUT var str$,p$
  693. .EDIT _text
  694. EDIT a$
  695. .EOF _data _io
  696. e%=EOF
  697. .ERASE _data
  698. ERASE
  699. Erases the current record in the current file.
  700. The next record is then current. If the erased record was the last record in a file, then following this command the current record will be null and EOF will return true.
  701. .ERR _error
  702. e%=ERR
  703. .ERR$ _error
  704. e$=ERR$(x%)
  705. .ERRX$ _error
  706.     x$=ERRX$
  707. .ESCAPE OFF
  708. ESCAPE OFF
  709. ESCAPE ON
  710. BEvaluates the mathematical string expression s$ and returns the floating-point result. s$ may include any mathematical function or operator. Note that floating-point arithmetic is always performed.
  711. On the Series 5, EVAL runs in the "context" of the current procedure, so globals and externals can be used in s$, procedures in loaded modules can be called and the current values of gX and gY, can be used etc. LOCAL variables cannot be used in s$ (because the translator cannot deference them).
  712. For example:
  713. AT 10,5 :PRINT "Calc:",
  714. TRAP INPUT n$
  715. IF n$="" :CONTINUE :ENDIF
  716. IF ERR=-114 :BREAK :ENDIF
  717. CLS :AT 10,4
  718. PRINT n$;"=";EVAL(n$)
  719. UNTIL 0
  720. See also VAL.
  721. ASets the text window font and style.
  722. Constants for the font UIDs are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  723. See 'The text and graphics windows' in the 'Graphics' chapter for more details.
  724. ("CLIENTS")
  725. CREATE "CLIENTS",A,names$
  726. OPEN "CLIENTS",A,names$
  727. ENDIF
  728. FRequired if DECLARE EXTERNAL is specified in the module.
  729. The first usage declares a variable as external. For example, EXTERNAL screenHeight%
  730. The second usage declares the prototype of a procedure (prototype includes the final : and the argument list). The procedure may then be referred to before it is defined. This allows parameter type-checking to be performed at translate-time rather than at runtime and also provides the necessary information for the translator to coerce numeric argument types. This is reasonable because OPL does not support argument overloading. The same coercion occurs as when calling the built-in keywords.
  731. Following the example of C and C++, you would normally provide a header file declaring prototypes of all the procedures and INCLUDE this header file at the beginning of the module which defines the declared procedures to ensure consistency. The header file would also be INCLUDEd in any other modules which call these procedures. Then you should use DECLARE EXTERNAL at the beginning of modules which include the header file so that the translator can ensure that these procedures are called with correct parameter types or types which can be coerced.
  732. The following is an example of usage of DECLARE EXTERNAL and EXTERNAL:
  733. DECLARE EXTERNAL
  734. EXTERNAL myProc%:(i%,l&)    
  735. REM or INCLUDE "myproc.oph" that defines all your procedures
  736. PROC test:
  737. LOCAL i%,j%,s$(10)
  738. REM j% is coerced to a long integer as specified by the prototype.
  739. myProc%:(i%,j%)
  740. REM translator 'Type mismatch' error:
  741. REM string can't be coerced to numeric type
  742. myProc%:(i%,s$)
  743. REM wrong argument count gives translator error
  744. myProc%:(i%)
  745. PROC myProc%:(i%,l&)
  746. REM Translator checks consistency with prototype above
  747. See DECLARE EXTERNAL.
  748. BSearches the current data file (or view on the Series 5) for fields matching a$. The search starts from the current record, so use NEXT to progress to subsequent records. FIND makes the next record containing a$ the current record and returns the number of the record found. Capitals and lower-case letters match.
  749. You can use wildcards:
  750. ?         matches any single character
  751. *        matches any group of characters.
  752. To find a record with a field containing Dr and either BROWN or BRAUN, use:
  753. F%=FIND("*DR*BR??N*")
  754. FIND("BROWN") will find only those records with a field consisting solely of the string BROWN.
  755. You can only search string fields.
  756. See also FINDFIELD.
  757. VDLike FIND, finds a string, makes the record with this string the current record, and returns the number of this record.
  758. a$ is the string for which to search: the search will be carried out in no% fields in each record, starting at the field with number start% (1 is the number of  the first field). start% and no% may refer to string fields only and other types will be ignored. The flag% argument specifies the type of search as explained below. If you want to search in all fields, use start%=1 and for no% use the number of fields you used in the OPEN/CREATE command.
  759. flags% should be specified as follows:
  760. search direction                    flags%
  761. backwards from current record            0
  762. forwards from current record             1
  763. backwards from end of file            2
  764. forwards from start of file                3
  765. Add 16 to the value of flag% given above to make the search case-dependent, where case-dependent means that the record will exactly match the search string in case as well as characters. Other wise the search will case-independent which means that upper case and lower case characters will match.
  766. See also the 'Data File Handling' chapter.
  767. /BReturns a string representation of the number x, to y% decimal places. The string will be up to z% characters long.
  768. Example: FIX$(123.456,2,7) returns "123.46".
  769. If z% is negative then the string is right-justified for example FIX$(1,2,-6) returns "  1.00" where there are two spaces to the left of the 1.
  770. If z% is positive then no spaces are added for example FIX$(1,2,6) returns "1.00".
  771. If the number x will not fit in the width specified by z%, then the string will just be asterisks, for example FIX$(256.99,2,4) returns "****".
  772. See also GEN$, NUM$, SCI$.
  773. iBReplaces TYPE on the Series 5. flags% values as follows:
  774. 1 specifies an application which can create files. It will then be included in the list of applications offered when the user creates a new file from the System screen.
  775. 2 prevents the application from appearing in the Extras bar. It is very unusual to have this flag set.
  776. Constants for these flags are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  777. FLAGS may only be used within the APP
  778. ENDA construct.
  779. See APP. See also the section on OPAs in the 'Advanced Topics' chapter.
  780. AFrees a previously allocated cell at pcell& (pcell%).
  781. The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The input value is therefore a long integer on the Series 5 and an integer on the Series 3c.
  782. See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcell& is guaranteed to fit into a short integer.
  783. ADraws a circle with the centre at the current position in the current drawable. If the value of  radius% is negative then no circle is drawn.
  784. If fill% is supplied and if fill%<>0 then the circle is filled with the current pen colour.
  785. See gELLIPSE, gCOLOR.
  786. 'ASets the pen colour of the current window. The red%,green%,blue% values specify a colour which will be mapped to white, black or one of the greys on non-colour screens. Note that if the values of red%, green% and blue% are equal, then a pure grey results, ranging from black (0) to white (255).
  787.  on the Series 5. If the flag is set to restrict the limit, pcell& is guaranteed to fit into a short integer.
  788. EDraws a one-pixel wide, black border around the edge of the current drawable. If width% and height% are supplied, a border shape of this size is drawn with the top left corner at the current position. If they are not supplied, the border is drawn around the whole of the current drawable.
  789. flags% controls three attributes of the border a shadow to the right and beneath, a one-pixel gap all around, and the type of corners used:
  790. flags%    effect
  791. 1            single pixel shadow
  792. 2             removes a single pixel shadow (leaves a gap for single pixel shadow on Series 3c )
  793. 3            double pixel shadow
  794. 4            removes a double pixel shadow (leaves a gap for double pixel shadow on Series 3c)
  795. $100            one-pixel gap all round
  796. $200             more rounded corners
  797. The shadows on the Series 5 will not appear in the same way as shadows on other objects such as dialogs and menu panes appear. To display such shadows on a window, you must specify them when using gCREATE. Hence you should use gCREATE (and  gXBORDER) in preference to gBORDER on the Series 5.
  798. You can combine the values to control the three different effects. (1, 2, 3 and 4 are mutually exclusive you cannot use more than one of them.) For example, for rounded corners and a double pixel shadow, use flags%=$203.
  799. Set flags%=0 for no shadow, no gap, and sharper corners.
  800. For example, to de-emphasise a previously emphasised border, use gBORDER with the shadow turned off:
  801. gBORDER 3         REM show border
  802. gBORDER 4         REM border off
  803. See also gXBORDER.
  804. GDraws a 3-D black and grey button at the current position in a rectangle of the supplied width w% and height h%, which fully encloses the button in all its states. text$ specifies up to 64 characters to be drawn in the button in the current font and style. You must ensure that the text will fit in the button.
  805. type%=1 draws a Series 3c button;  type%=2 specifies Series 5.
  806. state%=0 draws a raised button, state%=1 a semi-depressed (flat) button and state%=2 a fully-depressed (sunken) button.
  807. On the Series 5, there is added support so that bitmaps may be used on buttons. Three extra optional arguments can be passed which give the bitmap ID, the mask ID and the layout for the button respectively.  maskId% can be 0 to specify no mask.
  808. The following constants should be used for layout% to specify relative positions of the text and icon on a button,
  809. position of text        layout%
  810. right                0
  811. bottom            1
  812. top                2
  813. left            3
  814. The following constants can be added to the values above to specify how a button's excess space is to be allocated,
  815. share            0
  816. to text            $10
  817. to picture            $20
  818. When the layout is such that the text is at the top or the bottom, then text and picture are centred vertically and horizontally in the space allotted to them.  If the layout has text to the left or right, then the text is left aligned in the space allotted to it and the picture is right or left aligned respectively.  Both text and picture are centred vertically in this case.
  819. Examples:
  820. layout%    description
  821. $13    creates a button with text on the left and left aligned in any excess space.
  822. $20    creates a button with text on the right and the picture left aligned in any excess space.
  823. $10    creates a standard toolbar button, putting the text on the right.
  824. For a picture only with no text use text$="".
  825. 'Invalid arguments' error is raised if you use OPL windows for gBUTTON.  Read-only bitmaps may also be loaded using the Bitmap OPX. See the 'Using OPXs on the Series 5' for more details of how to do this.
  826. PH@ZXy
  827. .EVAL _conv
  828. d=EVAL(s$)
  829. .EXIST _file _data
  830. e%=EXIST(filename$)
  831. .EXP _math
  832.     e=EXP(x)
  833. dReturns ex - that is, the value of the arithmetic constant e (2.71828...) raised to the power of x.
  834. .EXTERNAL _mem
  835. %EXTERNAL variable
  836. EXTERNAL prototype
  837. .FIND _data
  838. f%=FIND(a$)
  839. .FINDFIELD _data
  840. #f%=FINDFIELD(a$,start%,no%,flags%)
  841. .FIRST _data
  842. FIRST
  843. RPositions to the first record in the current data file (or view on the Series 5).
  844. .FIX$ _conv
  845. f$=FIX$(x,y%,z%)
  846. .FLAGS _opa
  847. FLAGS flags%
  848. .FLT _conv
  849. f=FLT(x&)
  850. .FONT _text _font
  851. FONT id&,style%
  852. .FREEALLOC _mem
  853. FREEALLOC pcell&
  854. .gAT _draw _gtext
  855. gAT x%,y%
  856. ~Sets the current position using absolute co-ordinates. gAT 0,0 moves to the top left of the current drawable.
  857. See also gMOVE.
  858. .gBORDER _draw _win
  859. -gBORDER flags%,width%,height%
  860. gBORDER flags%
  861. .gBOX _draw
  862. gBOX width%,height%
  863. qDraws a box from the current position, width% to the right and height% down. The current position is unaffected.
  864. .gBUTTON _draw
  865. gBUTTON text$,type%,w%,h%,st%
  866. gBUTTON text$,type%,w%,h%,st%,bitmapId&
  867. gBUTTON text$,type%,w%,h%,st%,bitmapId&,maskId&
  868. gBUTTON text$,type%,w%,h%,st%,bitmapId&,maskId&,layout%
  869. BCopies a rectangle of the specified size (width w%, height h%) from the point x%,y% in drawable id%, to the current position in the current drawable.
  870. !    On the Series 5, it is unadvisable to use gCOPY to copy from windows as it is very slow. It should only be used for copying from bitmaps to windows or other bitmaps.
  871. As this command can copy both set and clear pixels, the same modes are available as when displaying text. Set mode% = 0 for set, 1 for clear, 2 for invert or 3 for replace. 0, 1 and 2 act only on set pixels in the pattern; 3 copies the entire rectangle, with set and clear pixels.
  872. The current position is not affected in either window.
  873. yECreates a window with specified position and size (width w%, height h%), and makes it both current and foreground. Sets the current position to 0,0, its top left corner. If v% is 1, the window will immediately be visible; if 0, it will be invisible.
  874. Returns id% which identifies this window for other keywords.
  875. flags% specifies the graphics mode to use and shadowing on the window.  By default the graphics mode is 2-colour and there is no shadow.
  876. The least significant 4 bits of flags% gives the colour-mode as before 0 (2 colour-mode), 1 (4 colour-mode), 2 (16 colour-mode).
  877. The next 4 bits may be set to specify the shadowing on the window. If 0, the window has no shadow. The next 4 bits give the shadow height relative to the window behind it (a height of N units gives a shadow of N(2 pixels).
  878. The flags% argument is most easily specified in hexadecimal:
  879. flags%    description
  880. $412    16 colour-mode ($2), shadowed window ($1), with height 4 units ($4) above the previous window with a shadow of 8 pixels.
  881. $010     2 colour-mode (black and white) shadowed window at the same height as the previous window.
  882. $101     4 colour mode window with no shadow (height ignored if shadow disabled).
  883. $111    4 colour mode window with shadow of 1 unit above window behind, i.e. 2 pixel shadow.
  884. Note that 63 windows may be open at any time and it is recommended that you use many small windows rather than a few large ones.
  885. ACreates a bitmap with the specified width and height, and makes it the current drawable. Sets the current position to 0,0, its top left corner.
  886. Returns id% which identifies this bitmap for other keywords.
  887. gCREATEBIT may be used with an optional third parameter which specifies the graphics mode of the bitmap to be created.  The values of these are as given in gCREATE. By default the graphics mode of a bitmap is 2-colour.
  888. See also gCLOSE,gCREATE.
  889. ADraws an ellipse with the centre at the current position in the current drawable. hRadius% is the horizontal distance in pixels from the centre of the ellipse to the left (and right) of the ellipse. vRadius% is the vertical distance from the centre of the ellipse to the top (and bottom). If the length of either radius is less than zero, then no ellipse is drawn.
  890. If fill% is supplied and if fill%<>0 then the ellipse is filled with the current pen colour.
  891. See gCIRCLE, gCOLOR.
  892. 0BReturns a string representation of the number x. The string will be up to y% characters long.
  893. Example GEN$(123.456,7) returns "123.456" and GEN$(243,5) returns "243".
  894. If y% is negative then the string is right-justified - for example GEN$(1,-6) returns  "     1" where there are five spaces to the left of the 1.
  895. If y% is positive then no spaces are added for example GEN$(1,6) returns "1".
  896. If the number x will not fit in the width specified by y%, then the string will just be asterisks, for example GEN$(256.99,4) returns "****".
  897. See also FIX$, NUM$, SCI$.
  898.  BWaits for a key to be pressed and returns the character code for that key.
  899. For example, if the A key is pressed with Caps Lock off, the integer returned is 97 (a), or 65 (A) if A was pressed with the Shift key down.
  900. The character codes of special keys, such as Pg Dn, are given in Appendix D.
  901. You can use KMOD to check whether modifier keys (Shift, Control, Psion (on the Series 3c), Fn (on the Series 5) and Caps Lock) were used.
  902. See Appendix D for the full character set for the Series 5. For the Series 3c, see the User Guide.
  903. See also KEY.
  904. DAWaits until a key is pressed and then returns which key was pressed, as a string.
  905. For example, if the A key is pressed in lower case mode, the string returned is "a".
  906. You can use KMOD to check whether any modifier keys (Shift, Control, Psion (on the Series 3c), Fn (on the Series 5) and Caps Lock) were used.
  907. See also KEY$.
  908. cBReturns new command-line arguments to an OPA, after a "change files" or "quit" event has occurred. The first character of the returned string is "C", "O" or "X". If the return is "C" or "O", the rest of the string is a filename.
  909. The first character has the following meaning:
  910. "C" - close down the current file, and create the specified new file,
  911. "O" - close down the current file, and open the specified existing file,
  912. "X" - close down the current file (if any) and quit the OPA.
  913. You can only call GETCMD$ once for each system message.
  914. See the 'Advanced Topics' chapter for more details of OPAs.
  915. See also CMD$.
  916. FWaits for an event to occur. Returns with a%() specifying the event. The data returned in a%() depends on the type of event that occurred. If the event is a key-press, (a%(1) AND $400) is guaranteed to be zero. For other events (a%(1) AND $400) is guaranteed to be non-zero.
  917. If a key has been pressed:    
  918. a%(1)            keycode (as for GET)
  919. a%(2) AND $00ff    modifier (as for KMOD) a%(2)/256        auto-repeat count (ignored by GET)
  920. If a program has moved toforeground:        a%(1)= $401background:         a%(1)= $402
  921. If the machine has switched on:     a%(1)= $403
  922. If the Psion wants an OPA tochange files or exit:     a%(1)= $404
  923. If the date changes:         a%(1)= $405
  924. Note that date change events are not detected by the Series 5.
  925. Also note that GETEVENT responds to all events to which GETEVENT32 responds, including pen events. The same codes are written to ev%(1) as GETEVENT32
  926. ev&() writes to ev&(1), but the array elements ev%(2) to ev%(6) are only set as detailed above.
  927. !    It is strongly recommended that you use GETEVENT32 rather than GETEVENT if you are using the Series 5. GETEVENT is supported only for backward compatibility and cannot be used to handle pen events in a satisfactory way.
  928. For a key-press event, the modifier is returned in a%(2) and is not returned by KMOD.
  929. -    If a non-key event such as 'foreground' occurs while a keyboard keyword such as GET, INPUT, MENU or DIALOG is being used, the event is discarded. So GETEVENT must be used if non-key events are to be monitored. If you need to use these keywords in OPAs, use LOCK ON / LOCK OFF around them, so that the System screen won't send messages to switch files or shutdown while the application cannot respond.
  930. The array (or string of integers) must be at least 6 integers long.
  931. See also TESTEVENT, GETCMD$, GETEVENT32.
  932. JLGets all event types handled by GETEVENT ev%() and additionally pointer (pen) events.  The latter are too large to fit into the array of integers provided for GETEVENT ev%(). ev&() must have at least 16 elements.
  933. All events return a 32-bit time stamp. The window ID mentioned below refers to the value returned by the gCREATE keyword. The modifier values and scancode values for a keypress (which specify a location on the keyboard) are given in the 'Advanced Topics' chapter and Appendix D.
  934. GETEVENT32 returns more information than GETEVENT, as listed below:
  935. If a key has been pressed:    (ev&(1) AND &400)=0    ev&(1)    keycode    ev&(2)    time stamp    ev&(3)    scan code    ev&(4)    modifier    ev&(5)     repeat
  936. Note that unlike the repeat for GETEVENT, the repeat for GETEVENT32 is strictly a repeat, i.e. if there is only one keypress, then the value of ev&(5) is 0.
  937. For all the other event types, ev&(1) is greater than &400:
  938. If the program has moved to    foreground:    ev&(1)=&401        ev&(2)    time stamp
  939. If the program has moved to    background:    ev&(1)=&402         ev&(2)     time stamp
  940. If the machine is switched on:.    ev&(1)=&403         ev&(2)     time stamp
  941. Note that this event is not enabled unless the appropriate flag is set (by default it is not): see SETFLAGS.
  942. If the Series 5 wants the OPLapplication to switch files or exit:    ev&(1)=&404
  943. If this event is received, GETCMD$ should be called to find out what action should be taken: see GETCMD$.
  944. If a key is pressed down:    ev&(1)=&406        ev&(2)     time stamp        ev&(3)     scan code        ev&(4)     modifiers
  945. If a key is released:    ev&(1)=&407        ev&(2)    time stamp        ev&(3)    scan code        ev&(4)     modifiers
  946. If a pen event occurs:    ev&(1)=&408
  947.         ev&(2)    time stamp        ev&(3)    window ID        ev&(4)    pointer type (see below)        ev&(5)     modifiers        ev&(6)     x-co-ordinate        ev&(7)    y-co-ordinate        ev&(8)    x-co-ordinate relative to parent window        ev&(9)    y-co-ordinate relative to parent window
  948. For pen events, ev&(4) has one of the following values: 0    pen down    1     pen up        6    drag
  949. If a pen enters contact with the    screen:    ev&(1)=&409        ev&(2)         time stamp        ev&(3)        window ID
  950. If a pen exits contact with the    screen:    ev&(1)=&40A         ev&(2)         time stamp        ev&(3)        window ID
  951. Constants for the array subscripts and the return values are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  952. Some pointer events, and pointer enters and exits, can be filtered out to avoid being swamped by unwanted event types. See POINTERFILTER.
  953. -    Note that for other unknown events, ev&(1) contains &1400 added to the code returned by the window server. ev&(2) is the timestamp and ev&(3)is the window ID, and the rest of the data returned by the window server is put into ev&(4), ev&(5), etc.
  954. -     If a non-key event such as 'foreground' occurs while a keyboard keyword such as GET, INPUT, MENU or DIALOG is being used, the event is discarded. So GETEVENT must be used if non-key events are to be monitored. If you need to use these keywords in OPAs, use LOCK ON / LOCK OFF around them, so that the System screen won't send messages to switch files or shutdown while the application cannot respond.
  955. See also GETEVENT, GETEVENTA32.
  956. AAsynchronous version of GETEVENT32.  GETEVENTA32 returns the same codes to the array ev&() as GETEVENT32.
  957. See GETEVENTC, GETEVENT32, GETEVENT. See also the 'I/O functions and commands' section in the 'Advanced Topics' chapter for details of asynchronous I/O functions.
  958. hBSets the font for current drawable to fontId%. The font may be one of the predefined fonts in the ROM or a user-defined font. See the 'Graphics' chapter for more details of fonts.
  959. Constants for the font UIDs are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and see Appendix E for a listing of it.
  960. User-defined fonts must first be loaded by gLOADFONT, then the font UIDs of the loaded fonts may be used with gFONT. Note that this is not the ID returned by gLOADFONT (which is the font file ID), but the UID defined in the font file itself.
  961. See also gLOADFONT, FONT.
  962. ASets the effect of all subsequent drawing commands gLINEBY, gBOX etc. on the current drawable.
  963. mode%            pixels will be:
  964. 0            set
  965. 1             cleared
  966. 2            inverted
  967. When you first use drawing commands on a drawable, they set pixels in the drawable. Use gGMODE to change this. For example, if you have drawn a black background, you can draw a white box outline inside it with either gGMODE 1 or gGMODE 2, followed by gBOX.
  968. RAChanges the pen colour between black and grey. mode% has the following effects:
  969. mode%=1 sets the foreground colour of the current drawable to light grey.  This is the same colour as would be achieved by using gCOLOR $aa,$aa,$aa.
  970. mode% of any other value sets the foreground colour to black (the default).
  971. See also DEFAULTWIN and gCREATE.
  972. ADisplays an information message for about two seconds, in the bottom right corner of the screen. For example, GIPRINT "Not Found" displays Not Found. If a string is too long for the screen, it will be clipped.
  973. If c% is given, it controls the corner in which the message appears:
  974. c%        corner
  975. 0        top left
  976. 1        bottom left
  977. 2        top right
  978. 3         bottom right (default)
  979. Only one message can be shown at a time. You can make the message go away - for example, if a key has been pressed - with GIPRINT "".
  980. ADraws a line from the current position to a point dx% to the right and dy% down. Negative dx% and dy% mean left and up respectively.
  981. The Series 5 never draws the end point, so for gLINEBY dx%,dy%, point gX+dx%,gY+dy% is not drawn.
  982. Note, however, that OPL specially plots the point when the start and end-point coincide.
  983. For all machines, the current position moves to the end of the line drawn.
  984. gLINEBY 0,0 sets the pixel at the current position.
  985. See also gLINETO, gPOLY.
  986. ADraws a line from the current position to the point x%,y%. The current position moves to x%,y%.
  987. The Series 5 never draws the end point, so for gLINETO x%,y%,  point x%,y% is not drawn
  988. Note, however, that OPL specially plots the point when the start and end-point coincide.
  989. To plot a single point on all machines, use gLINETO to the current position (or gLINEBY 0,0).
  990. See also gLINEBY, gPOLY.
  991. mDLoads a bitmap from the named bitmap file and makes it the current drawable. Sets the current position to 0,0, its top left corner.
  992. gLOADBIT does not add a default filename extension to the input argument name.
  993. Note that on the Series 5, gLOADBIT loads EPOC Picture files, which are naturally in the same file format that is saved by gSAVEBIT. EPOC Picture files can also be generated by exporting files created by the Sketch application. These are called multi-bitmap files (MBMs), though often containing just one bitmap as in the case of gSAVEBIT or Sketch files, and are often given an extension .MBM.
  994. The bitmap is kept as a local copy in memory.
  995. Returns id% which identifies this bitmap for other keywords.
  996. write%=0 sets read-only access. Attempts to write to the bitmap in memory will be ignored, but the bitmap can be used by other programs without using more memory. write%=1 allows you to write to and re-save the bitmap. This is the default case.
  997. For bitmap files which contain more than one bitmap, index% specifies which one to load. For the first bitmap, use index%=0, which is also the default value.
  998. See also gCLOSE.
  999. wBLoads the user-defined fonts specified in the file file$ and returns the file ID of the font file, which can be used only with gUNLOADFONT.  The maximum number of font files which may be loaded at any one time is 16.
  1000. To use the fonts in a loaded font file you need to use their published UIDs which will be defined in the font file itself, for example:
  1001. fileId%=gLOADFONT("Music1")
  1002. gFONT KMusic1Font1&
  1003. gUNLOADFONT fileId%
  1004. gFONT itself is very efficient, so you should normally load all required fonts at the start of a program.
  1005. Note that the built-in fonts are automatically available, and do not need loading.
  1006. See gUNLOADFONT.
  1007. @Declares variables to be used in the current procedure (as does the LOCAL command) and (unlike LOCAL) in any procedures called by the current procedure, or procedures called by them.
  1008. The variables may be of 4 types, depending on the symbol they end with:
  1009. Variable names not ending with $, %, & or () are floating-point variables, for example price, x
  1010. Those ending with a % are integer variables, for example x%, sales92%
  1011. Those ending with an & are long integer variables, for example x&, sales92&.
  1012. Those ending with a $ are string variables. String variable names must be followed by the maximum length of the string in brackets for example names$(12), a$(3)
  1013. Array variables have a number immediately following them in brackets which specifies the number of elements in the array. Array variables may be of any type, for example: x(6),y%(5),f$(5,12),z&(3).
  1014. When declaring string arrays, you must give two numbers in the brackets. The first declares the number of elements, the second declares their maximum length. For example surname$(5,8) declares five elements, each up to 8 characters long.
  1015. Variable names may be any combination of up to 32 numbers and alphabetic characters and the underscore character. They must start with a alphabetic character or an underscore.
  1016. The length of a variable name includes
  1017.  the %, & or $ sign, but not the () in string and array variables.
  1018. More than one GLOBAL or LOCAL statement may be used, but they must be on separate lines, immediately after the procedure name.
  1019. See also LOCAL.
  1020. lASets the window specified by id% to the selected foreground/background position, and redraws the screen. Position 1 is the foreground window, position 2 is next, and so on. Any position greater than the number of windows is interpreted as the end of the list.
  1021. On creation, a window is at position 1 in the list.
  1022. Raises an error if id% is a bitmap.
  1023. See also gRANK.
  1024. AAGoes to the line following the label:: and continues from there. The label
  1025. Must be in the current procedure
  1026. Must start with a letter and end with a double colon, although the double colon is not necessary in the GOTO statement
  1027. May be up to 32 characters long on the Series 5, or 8 on the Series 3c, excluding the colons.
  1028. AFills a rectangle of the specified size from the current position with repetitions of the drawable id%.
  1029. As with gCOPY, this command can copy both set and clear pixels, so the same modes are available as when displaying text. Set mode%=0 for set, 1 for clear, 2 for invert or 3 for replace. 0, 1 and 2 act only on set pixels in the pattern; 3 copies the entire rectangle, with set and clear pixels.
  1030. If you set id%=-1 a pre-defined grey pattern is used.
  1031. The current position is unaffected.
  1032. &FReads a horizontal line from the black plane of the drawable id%, length ln%, starting at x%,y%. The leftmost 16 pixels are read into d%(1), with the first pixel read into the least significant bit.
  1033. gPEEKLINE has an extra optional parameter mode% to specify the colour mode:
  1034. mode%    colour mode        colour of pixel which sets bits
  1035. -1          black and white         black
  1036. 0          black and white         white
  1037. 1          4-colour mode         white
  1038. 2          16-colour mode         white
  1039. The default mode% is -1.  For 4 and 16-colour modes, 2 and 4 bits per pixel respectively are used.  This is to enable the colour of the pixel to be ascertained from the bits which are set.  White results in all 2 or 4 bits being set, while black sets none of them. For example, in a 4colour window, with the colour set by
  1040. gCOLOR 16,16,16
  1041. a pixel of a line would peek as 0001 in binary.  Similarly, a pixel of a line with the colour set to
  1042. gCOLOR 80,80,80
  1043. would result in the value 0101 in binary when peeked.
  1044. The array d%() must be long enough to hold the data. You can work out the number of integers required with ((ln%+15)/16) (using whole-number division).
  1045. Note that if the optional parameter mode% is used on the Series 5, the array size allowed must be adjusted accordingly: it must be at least twice as long as the array needed for black and white if the line you wish to peek in 4-colour mode and four times as long in 16-colour mode.
  1046. On the Series 3c, if you add $8000 to id%, the grey plane (not the black plane) will be peeked, but note that $8000 ORed with the id% on the Series 5 will raise an 'Invalid arguments' error.
  1047. CDraws a sequence of lines, as if by gLINEBY and gMOVE commands.
  1048. The array is set up as follows:
  1049. a%(1)    starting x position
  1050. a%(2)    starting y position
  1051. a%(3)    number of pairs of offsets
  1052. a%(4)    dx1%
  1053. a%(5)    dy1%
  1054. a%(6)    dx2%
  1055. a%(7)    dy2% etc.
  1056. Each pair of numbers dx1%,dy1%, for example specifies a line or a movement. To draw a line, dy% is the amount to move down, while dx% is the amount to move to the right multiplied by two.
  1057. To specify a movement (i.e. without drawing a line) work out the dx%,dy% as for a line, then add 1 to dx%.
  1058. (For drawing/movement up or left, use negative numbers.)
  1059. gPOLY is quicker than combinations of gAT, gLINEBY and gMOVE.
  1060. Example, to draw three horizontal lines 50 pixels long at positions 20,10, 20,30 and 20,50:
  1061. a%(1)=20 :a%(2)=10         REM 20,10
  1062. a%(3)=5                 REM 5 operations
  1063. a%(4)=50*2  :a%(5)=0         REM draw right 50
  1064. a%(6)=0*2+1 :a%(7)=20         REM move down 20
  1065. a%(8)=-50*2 :a%(9)=0        REM draw left 50
  1066. a%(10)=0*2+1 :a%(11)=20        REM draw left 50
  1067. a%(12)=50*2 :a%(13)=0        REM draw right 50
  1068. gPOLY a%()
  1069. ADisplays a list of expressions at the current position in the current drawable. All variable types are formatted as for PRINT.
  1070. Unlike PRINT, gPRINT does not end by moving to a new line. A comma between expressions is still displayed as a space, but a semicolon has no effect. gPRINT without a list of expressions does nothing.
  1071. See also gPRINTB, gPRINTCLIP, gTWIDTH, gXPRINT, gTMODE.
  1072. CDisplays text t$ in a cleared box of width w% pixels. The current position is used for the left side of the box and for the baseline of the text.
  1073. al% controls the alignment of the text in the box 1 for right aligned, 2 for left aligned, or 3 for centred.
  1074. tp% and bt% are the clearances between the text and the top/bottom of the box. Together with the current font size, they control the height of the box. An error is raised if tp% plus the font ascent is greater than 255.
  1075. m% controls the margins. For left alignment, m% is an offset from the left of the box to the start of the text. For right alignment, m% is an offset from the right of the box to the end of the text. For centring, m% is an offset from the left or right of the box to the region in which to centre, with positive m% meaning left and negative meaning right.
  1076. If values are not supplied for some arguments, these defaults are used:
  1077. al%        left
  1078. tp%        0
  1079. bt%        0
  1080. m%        0
  1081. See also gPRINT, gPRINTCLIP, gTWIDTH, gXPRINT.
  1082. XASaves the current drawable as the named bitmap file. If width% and height% are given, then only the rectangle of that size from the current position is copied.
  1083. gSAVEBIT does not add a default filename extension to the input argument name if none is provided on the Series 5, while on the Series 3c, if name$ has no file extension .PIC is used.
  1084. AScrolls pixels in the current drawable by offset dx%,dy%. Positive dx% means to the right, and positive dy% means down. The drawable itself does not change its position.
  1085. If you specify a rectangle in the current drawable, at x%,y% and of size wd%,ht%, only this rectangle is scrolled.
  1086. The areas dx% wide and dy% deep which are "left behind" by the scroll are cleared.
  1087. The current position is not affected.
  1088. .gMOVE _draw
  1089. gMOVE dx%,dy%
  1090. Moves the current position dx% to the right and dy% downwards, in the current drawable.
  1091. A negative dx% causes movement to the left; a negative dy% causes upward movement.
  1092. See also gAT.
  1093. .gORDER _win
  1094. gORDER id%,position%
  1095. .gORIGINX _win
  1096. x%=gORIGINX
  1097. Returns the gap between the left side of the screen and the left side of the current window.
  1098. Raises an error if the current drawable is a bitmap.
  1099. .gORIGINY _win
  1100. y%=gORIGINY
  1101. Returns the gap between the top of the screen and the top of the current window.
  1102. Raises an error if the current drawable is a bitmap.
  1103. .GOTO _control
  1104. )GOTO label or  GOTO label::
  1105. label::
  1106. .GOTOMARK _data
  1107. GOTOMARK b%
  1108. {Makes the record with bookmark b%, as returned by BOOKMARK, the current record. b% must be a bookmark in the current view.
  1109. .gPATT _win _bit _draw
  1110. gPATT id%,width%,height%,mode%
  1111. .gPEEKLINE _win _bit
  1112. @gPEEKLINE id%,x%,y%,d%(),ln%
  1113. gPEEKLINE id%,x%,y%,d%(),ln%,mode%
  1114. .gPOLY _draw
  1115. gPOLY a%()
  1116. .gPRINT _gtext
  1117. gPRINT list of expressions
  1118. .gPRINTB _gtext
  1119. mgPRINTB t$,w%,al%,tp%,bt%,m%
  1120. gPRINTB t$,w%,al%,tp%,bt%
  1121. gPRINTB t$,w%,al%,tp%
  1122. gPRINTB t$,w%,al%
  1123. gPRINTB t$,w%
  1124. .gPRINTCLIP _gtext
  1125. w%=gPRINTCLIP(text$,width%)
  1126. Displays text$ at the current position, displaying only as many characters as will fit inside width% pixels. Returns the number of characters displayed.
  1127. See also gPRINT, gPRINTB, gTWIDTH, gXPRINT, gTMODE.
  1128. .gRANK _win
  1129. rank%=gRANK
  1130. Returns the foreground/background position, from 1 to 64 on the Series 5, and 1 to 8 on the Series 3c, of the current window.
  1131. Raises an error if the current drawable is a bitmap.
  1132. See also gORDER.
  1133. .gSAVEBIT _win _bit
  1134. -gSAVEBIT name$,width%,height%
  1135. gSAVEBIT name$
  1136. .gSCROLL _draw _win _bit
  1137. .gSCROLL dx%,dy%,x%,y%,wd%,ht%
  1138. gSCROLL dx%,dy%
  1139. .gSETPENWIDTH _pen
  1140. gSETPENWIDTH width%
  1141. =Sets the pen width in the current drawable to width% pixels.
  1142. SAChanges position and, optionally, the size of the current window.
  1143. An error is raised if the current drawable is a bitmap.
  1144. The current position is unaffected.
  1145. If you use this command on the default window, you must also use the SCREEN command to ensure that the area for PRINT commands to use is wholly contained within the default window.
  1146. ASets the style of text displayed in subsequent gPRINT, gPRINTB and gPRINTCLIP commands on the current drawable.
  1147. style%    text style
  1148. 0            normal
  1149. 1            bold
  1150. 2             underlined
  1151. 4            inverse
  1152. 8            double height
  1153. 16             mono-spaced
  1154. 32            italic
  1155. You can combine these styles by adding their values for example, to set bold, underlined and double height, use gSTYLE 11, as 11=1+2+8.
  1156. This command does not affect non-graphics commands, like PRINT.
  1157. cBSets the way characters are displayed by subsequent gPRINT and gPRINTCLIP commands on the current drawable.
  1158. mode%            pixels will be
  1159. 0            set
  1160. 1             cleared
  1161. 2            inverted
  1162. 3            replaced
  1163. When you first use graphics text commands on a drawable, each dot in a letter causes a pixel to be set in the drawable. This is mode%=0.
  1164. When mode% is 1 or 2, graphics text commands work in a similar way, but the pixels are cleared or inverted. When mode% is 3, entire character boxes are drawn on the screen - pixels are set in the letter and cleared in the background box.
  1165. This command does not affect other text display commands.
  1166. DThe Psion's screen is usually updated whenever you display anything on it. gUPDATE OFF switches off this feature. The screen will then be updated as few times as possible (though note that some keywords will always cause an update.) You can still force an update by using the gUPDATE command on its own.
  1167. This can result in a considerable speed improvement in some cases. You might, for example, use gUPDATE OFF, then a sequence of graphics commands, followed by gUPDATE. You should certainly use gUPDATE OFF if you are about to write exclusively to bitmaps.
  1168. gUPDATE ON returns to normal screen updating.
  1169. gUPDATE affects anything that displays on the screen. If you are using a lot of PRINT commands, gUPDATE OFF may make a noticeable difference in speed.
  1170. Note that with gUPDATE OFF, the location of errors which occur while the procedure is running may be incorrectly reported. For this reason, gUPDATE OFF is best used in the final stages of program development, and even then you may have to remove it to locate some errors.
  1171. EDDraws a border in the current drawable of a specified type, fitting inside a rectangle of the specified size or with the size of the current drawable if no size is specified.
  1172. type%=1 for drawing the Series 3c 3-D grey and black border. A shadow or a gap for a shadow is always assumed.
  1173. type%=2 for drawing the Series 5 borders.
  1174.     Values for flags% and their effects on the Series 5 are as follows,
  1175. border type                flags%    
  1176. none                $00
  1177. single black                $01
  1178. shallow sunken            $42
  1179. deep sunken            $44
  1180. deep sunken with outline        $54
  1181. shallow raised            $82
  1182. deep raised                $84
  1183. deep raised with outline        $94
  1184. vertical bar                $22
  1185. horizontal bar            $2a
  1186. Constants for these flags and types are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  1187. The following values of flags% apply to all border types:
  1188. 0 for normal corners
  1189. Adding $100 leaves 1 pixel gap around the border.
  1190. Adding $200 for more rounded corners
  1191. Adding $400 for losing a single pixel.
  1192. If both $400 and $200 are mistakenly supplied, $200 has priority.
  1193. See also gBORDER.
  1194. BDisplays string$ at the current position, with precise highlighting or underlining. The current font and style are still used, even if the style itself is inverse or underlined. If text mode 3 (replace) is used both set and cleared pixels in the text are drawn.
  1195. flags% has the following effect:
  1196. flags%    effect 
  1197. 0            normal, as with gPRINT
  1198. 1             inverse
  1199. 2            inverse, except corner pixels
  1200. 3            thin inverse
  1201. 4            thin inverse, except corner pixels
  1202. 5            underlined
  1203. 6             thin underlined
  1204. Where lines of text are separated by a single pixel, the thin options maintain the separation between lines.
  1205. gXPRINT does not support the display of a list of expressions of various types.
  1206. FGives the name of the bitmap file mbm$ (also known as an EPOC Picture file) to use as the icon for an OPL Application.
  1207. If the ICON command is not used inside the APP
  1208. ENDA structure, then a default icon is used, but the rest of the information in the APP..ENDA construct is still used to specify the other features of the OPL application.
  1209. On the Series 5, mbm$ is a multi-bitmap file which can contain up to three bitmap/mask pairs - the sizes are 24, 32 and 48 squares. These different sizes are used for the different zoom levels in the system screen. The sizes are read from the MBM and the most suitable size is zoomed if the exact sizes required are not provided or if some are missing.
  1210. In fact, you can use ICON more than once within the APP...ENDA construct on the Series 5. The translator only insists that all icons are paired with a mask of the same size in the final ICON list. This allows you to use pairs of MBMs containing just one bitmap as produced by the Sketch application. For example, you could specify them individually:
  1211. APP ...
  1212. ICON "icon24.mbm"
  1213. ICON "mask24.mbm"
  1214. ICON "icon32.mbm"
  1215. ICON "mask32.mbm"
  1216. ICON "icon48.mbm"
  1217. ICON "mask48.mbm"
  1218. or with pairs in each MBM:
  1219. APP ...
  1220. ICON "iconMask24"
  1221. ICON "iconMask32"
  1222. ICON "iconMask48"
  1223. or with all the bitmaps as just one MBM, as would normally be the case if prepared on the PC using the BMCONV tool and the AIFTOOL (description of these tools is beyond the scope of this manual and you should refer to the EPOC32 C++ Software Development Kit (SDK), which is available from Psion Software plc, for more details).
  1224. This command can only be used between APP and ENDA.
  1225. See the 'Advanced Topics' chapter for more details of OPL applications.
  1226. CDoes either
  1227. the statements following the IF condition
  1228. the statements following one of the ELSEIF conditions (there may be as many ELSEIF statements as you like none at all if you want)
  1229. the statements following ELSE (or, if there is no ELSE, nothing at all). There may be either one ELSE statement or none.
  1230. After the ENDIF statement, the lines following ENDIF carry on as normal.
  1231. IF, ELSEIF, ELSE and ENDIF must be in that order.
  1232. Every IF must be matched with a closing ENDIF.
  1233. You can also have an IF...ENDIF structure within another, for example:
  1234. IF condition1
  1235. IF condition2
  1236. ENDIF
  1237. ENDIF
  1238. condition is an expression returning a logical value for example a<b. If the expression returns logical true (non-zero) then the statements following are executed. If the expression returns logical false (zero) then those statements are ignored. For more details about logical expressions, see Appendix B.
  1239. CIncludes a file, file$, which may contain CONST definitions, prototypes for OPX procedures and prototypes for module procedures. The included file may not include module procedures themselves.  Procedure and OPX procedure prototypes allow the translator to check parameters and coerce numeric parameters (that are not passed by reference) to the required type.
  1240. Including a file is logically identical to replacing the INCLUDE statement with the file's contents.
  1241. The filename of the header may or may not include a path. If it does include a path, then OPL will only scan the specified folder for the file. However, the default path for INLCUDE is \System\Opl\, so when INCLUDE is called without specifying a path, OPL looks for the file firstly in the current folder and then in \System\Opl\ in all drives from Y: to A: and then in Z:, excluding any remote drives.
  1242. See CONST, EXTERNAL.  See also the 'Using OPXs on the Series 5' chapter.
  1243. @Waits for a value to be entered at the keyboard, and then assigns the value entered to a variable or data file field.
  1244. You can edit the value as you type it in. All the usual editing keys are available: the arrow keys move along the line, Esc clears the line and so on.
  1245. If inappropriate input is entered, for example a string when the input was to be assigned to an integer variable, a ? is displayed and you can try again. However, if you used TRAP INPUT, control passes on to the next line of the procedure, with the appropriate error condition being set
  1246.  and the value of the variable remaining unchanged.
  1247. INPUT is usually used in conjunction with a PRINT statement:
  1248. PROC exch:
  1249. LOCAL pds,rate
  1250. PRINT "Pounds Sterling?",
  1251. INPUT pds
  1252. PRINT "Rate (DM)?",
  1253. INPUT rate
  1254. PRINT "=",pds*rate,"DM"
  1255. UNTIL 0
  1256. Note the commas at the end of the PRINT statements, used so that the cursor waiting for input appears on the same line as the messages.
  1257. .TRAP INPUT _text
  1258. If a bad value is entered (for example "abc" for a%) in response to a TRAP INPUT, the ? is not displayed, but the ERR function can be called to return the value of the error which has occurred. If the Esc key is pressed while no text is on the input line, the 'Escape key pressed' error (number -114) will be returned by ERR (provided that the INPUT has been trapped). You can use this feature to enable someone to press the Esc key to escape from inputting a value.
  1259. See also EDIT. This works like INPUT, except that it displays a string to be edited and then assigned to a variable or field. It can only be used with strings.
  1260. AReturns the integer (in other words the whole number) part of the floating-point expression x. The number is returned as a long integer.
  1261. Positive numbers are rounded down, and negative numbers are rounded up for example INT(-5.9) returns -5 and INT(2.9) returns 2. If you want to round a number to the nearest integer, add 0.5 to it (or subtract 0.5 if it is negative) before you use INT.
  1262. See also INTF.
  1263. AReturns the last key pressed as a string, if there has been a keypress since the last use of the keyboard by INPUT, EDIT, GET, GET$, KEY, KEY$, MENU and DIALOG.
  1264. If no key has been pressed, a null string ("") is returned.
  1265. See Appendix D for a list of special key codes. You can use KMOD to check whether modifier keys (Shift, Control, Fn (on the Series 5), Psion (on the Series 3c) and Caps Lock) were used.
  1266. This command does not wait for a key to be pressed, unlike GET$.
  1267. AReturns the length of the previously allocated cell at pcell& (pcell% on the Series 3c).
  1268. Cells are allocated lengths that are the smallest multiple of four greater than the size originally requested. An error will be raised if the cell address argument is not in the range known by the heap.
  1269. See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, len& is guaranteed to fit into an integer.
  1270. AReturns an integer showing the position in a$ where b$ occurs, or zero if b$ doesn't occur in a$. The search matches upper and lower case.
  1271. Example: LOC("STANDING","AND") would return the value 3 because the substring AND starts at the third character of the string STANDING.
  1272. %APrecedes a remark you include to explain how a program works. All text after the REM up to the end of the line is ignored.
  1273. When you use REM at the end of a line you need only precede it with a space, not a space and a colon.
  1274. Examples:
  1275. INPUT a :b=a*.175  REM b=TAX
  1276. INPUT a :b=a*.175 :REM b=TAX
  1277. NThese functions are covered in detail in the 'Advanced Topics' chapter.
  1278. r%=IOA(h%,f%,var status%,var a1,var a2)
  1279. This has the same form as IOC, but it returns an error value of the request is not completed successfully. IOC should be used in preference to IOA.
  1280. IOC(h%,f%,var status%,var a1,var a2)
  1281. Make an I/O request with guaranteed completion. The device driver opened with handle h% performs the asynchronous I/O function f% with two further arguments, a1 and a2. The argument status% is set by the device driver. If an error occurs while making a request, status% is set to an appropriate values, but IOC always returns zero, not an error value. .An IOWAIT or IOWAITSTAT must be performed for each IOC. IOC should be used in preference to IOA.
  1282. r%=IOCANCEL(h%)
  1283. Cancels any outstanding asynchronous I/O request (IOC or IOA). Note, however, that the request will still complete, so the signal must be consumed using IOWAITSTAT.
  1284. r%=IOCLOSE(h%)
  1285. Closes a file with the handle h%.
  1286. r%=IOOPEN(var h%,name$,mode%)
  1287. Creates or opens a file called name$. Defines h% for use by other I/O functions. mode% specifies how to open the file. For unique file creation, use IOOPEN(var h%,addr%,mode%)
  1288. r%=IOREAD(h%,addr&,maxLen%)
  1289. Reads from the file with the handle h%. address% is the address of a buffer large enough to hold a maximum of maxLen% bytes. The value returned to r% is the actual number of bytes read or, if negative, is an error value.
  1290. r%=IOSEEK(h%,mode%,var off&)
  1291. Seeks to a position in a file that has been opened for random access. mode% specifies how the offset argument off& is to be used. Values for mode% may be found in the 'Advanced topics' chapter. off& may be positive to move forwards or negative to move backwards. IOSEEK sets the variable off& to the absolute position set.
  1292. IOSIGNAL
  1293. Signals an asynchronous I/O function's completion.
  1294. r%=IOW(h%,func%,var a1,var a2)
  1295. The device driver opened with handle h% performs the synchronous I/O function func% with the two further arguments.
  1296. IOWAIT
  1297. Waits for an asynchronous I/O function to signal completion.
  1298. IOWAITSTAT var stat%
  1299. Waits for an asynchronous function, called with IOC or IOA, to complete.
  1300. IOWAITSTAT32 var stat&
  1301. Takes a 32-bit status word. IOWAITSTAT32 should be called only when you need to wait for completion of a request made using a 32-bit status word when calling an asynchronous OPX procedure.
  1302. -  The initial value of a 32-bit status word while it is still pending (i.e. waiting to complete) is &80000001 (KStatusPending32& in Const.oph: see the 'Calling Procedures' chapter for details of how to use this file). For a 16-bit status word the 'pending value' is -46 (KErrFilePending%).
  1303. r%=IOWRITE(h%,addr&,length%)
  1304. Writes length% bytes in a buffer at address% to the file with the handle h%.
  1305. IOYIELD
  1306. Ensures that any asynchronous handler set up with IOC or IOA is given a chance to run. IOYIELD must always be called before polling status words on the Series 5, i.e. before reading a 16-bit status word if IOWAIT or IOWAITSTAT have not been used first.
  1307. Note the following example when you use #:
  1308. On the Series 3c you would call IOSEEK using,
  1309. ret%=IOSEEK(h%,mode%,#ptrOff%)
  1310. but on the Series 5 you would use,
  1311. ret%=IOSEEK(h%,mode%,#ptrOff&)
  1312. passing the long integer ptrOff&.
  1313. See also the '32-bit addressing' section in the 'Advanced Topics' chapter.
  1314. .KEY _key
  1315. Usage:    k%=KEY
  1316. Returns the character code of the key last pressed, if there has been a keypress since the last use of the keyboard by INPUT, EDIT, GET, GET$, KEY, KEY$, MENU and DIALOG.
  1317. If no key has been pressed, zero is returned.
  1318. See Appendix D for a list of special key codes. You can use KMOD to check whether modifier keys (Shift, Control, Fn (on the Series 5), Psion (on the Series 3c) and Caps Lock) were used.
  1319. This command does not wait for a key to be pressed, unlike GET.
  1320. DReturns a code representing the state of the modifier keys (whether they were pressed or not) at the time of the last keyboard access, such as a KEY function. The modifiers have these codes:
  1321.     decimal code        hex code
  1322.     2    Shift down    $2
  1323.     4     Control down    $4
  1324.     128    Fn down    $80
  1325. If there was no modifier, the function returns 0. If a combination of modifiers was pressed, the sum of their codes is returned - for example 20 is returned if Control (4) was held down and Caps Lock (16) was on.
  1326. Always use immediately after a KEY/KEY$/GET/GET$ statement.
  1327. The value returned by KMOD has one binary bit set for each modifier, as shown above. By using the logical operator AND on the value returned by KMOD you can check which of the bits are set, in order to see which modifier keys were held down. For more details on AND, see Appendix B.
  1328. Example:
  1329. PROC modifier:
  1330. LOCAL k%,mod%
  1331. PRINT "Press a key" :k%=GET
  1332. CLS :mod%=KMOD
  1333. PRINT "Key code",k%,"with"
  1334. IF mod%=0
  1335. PRINT "no modifier"
  1336. ENDIF
  1337. IF mod% AND 2
  1338. PRINT "Shift down"
  1339. ENDIF
  1340. IF mod% AND 4
  1341. PRINT "Control down"
  1342. ENDIF
  1343. IF mod% AND 8                REM only needed on Series 3c
  1344. PRINT "Psion down"
  1345. ENDIF
  1346. IF mod% AND 16
  1347. PRINT "Caps Lock on"
  1348. ENDIF
  1349. IF mod% AND 128                REM only needed on Series 5
  1350. PRINT "Fn down"
  1351. ENDIF
  1352. .ICON _opa
  1353. ICON 'mbm$
  1354. .IF ELSE ELSEIF ENDIF _control
  1355. ?IF condition1
  1356.   ...
  1357.  ELSEIF condition2
  1358.   ...
  1359.  ELSE
  1360.   ...
  1361. ENDIF
  1362. .INCLUDE _mem
  1363. INCLUDE file$
  1364. .INPUT _text
  1365. INPUT variable
  1366. INPUT log.field
  1367. .INSERT _data
  1368. INSERT
  1369. Inserts a new, blank record into the current view of a database. The fields can then be assigned to before using PUT or CANCEL.
  1370. .INT _conv
  1371. i&=INT(x)
  1372. .INTF _conv
  1373. i=INTF(x)
  1374. Used in the same way as the INT function, but the value returned is a floating-point number. For example, INTF(1234567890123.4) returns 1234567890123.0
  1375. You may also need this when an integer calculation may exceed integer range.
  1376. See also INT.
  1377. .INTRANS _data
  1378. i&=INTRANS
  1379. Finds out whether the current view is in a transaction. Returns -1 if it is in a transaction or 0 if it is not.
  1380. See also BEGINTRANS.
  1381. .I/O functions _io
  1382. .KEY$ _key
  1383. k$=KEY$
  1384. .KEYA _key
  1385. !err%=KEYA(var stat%,var key%(1))
  1386. qThis is an asynchronous keyboard read function.
  1387. See the 'Advanced Topics' chapter for details.
  1388. Cancel with KEYC.
  1389. .KEYC _key
  1390. err%=KEYC(var stat%)
  1391. Cancels the previously called KEYA function with status stat%. Note that KEYC consumes the signal (unlike IOCANCEL), so IOWAITSTAT should not be used after KEYC.
  1392. See the 'Advanced Topics' chapter for details.
  1393. .KILLMARK _data
  1394. KILLMARK b%
  1395. Removes the bookmark b%, which has previously been returned by BOOKMARK, from the current view of a database.
  1396. See BOOKMARK, GOTOMARK.
  1397. .KMOD _key
  1398. k%=KMOD
  1399. .LAST _data
  1400. -Positions to the last record in a data file.
  1401. .LCLOSE _device
  1402. LCLOSE
  1403. dCloses the device opened with LOPEN. (The device is also closed automatically when a program ends.)
  1404. BLoads a translated OPL module so that procedures in that module can be called. Until a module is loaded with LOADM, calls to procedures in that module will give an error.
  1405. module$ is a string containing the name of the module. Specify the full file name only where necessary.
  1406. Example: LOADM "MODUL2"
  1407. Up to 8 modules on the Series 5, or 4 on the Series 3c, can be in memory at any one time, including the top level module; if you try to LOADM a ninth (fifth) module, you get an error. Use UNLOADM to remove a module from memory so that you can load a different one.
  1408. By default, LOADM always uses the folder of the top level module. It is not affected by the SETPATH command.
  1409. FUsed to declare variables which can be referenced only in the current procedure. Other procedures may use the same variable names to create new variables. Use GLOBAL to declare variables common to all called procedures.
  1410. The variables may be of 4 types, depending on the symbol they end with:
  1411. Variable names not ending with $, %, & or () are floating-point variables, for example price, x
  1412. Those ending with a % are integer variables, for example x%, sales92%
  1413. Those ending with an & are long integer variables, for example x&, sales92&.
  1414. Those ending with a $ are string variables. String variable names must be followed by the maximum length of the string in brackets, for example names$(12), a$(3)
  1415. Array variables have a number immediately following them in brackets which specifies the number of elements in the array. Array variables may be of any type, for example: x(6),y%(5),f$(5,12),z&(3)
  1416. When declaring string arrays, you must give two numbers in the brackets. The first declares the number of elements, the second declares their maximum length. For example surname$(5,8) declares five elements, each up to 8 characters long.
  1417. Variable names may be any combination of up to 32 numbers, alphabetic letters and the underscore character. They must start with a letter or an underscore. The length includes the %, & or $ sign, but not the () in string and array variables.
  1418. More than one GLOBAL or LOCAL statement may be used, but they must be on separate lines, immediately after the procedure name.
  1419. See also GLOBAL, CONST and the 'Variables and Constants' chapter.
  1420. BMark an OPA (OPL application) as locked or unlocked. When an OPA is locked with LOCK ON, the System screen will not send it events to change files or quit.
  1421. If, for example, you move to the task list or the document name in the System screen try to stop that running OPA by using the 'Close file' button or Ctrl+E respectively, a message will appear, indicating that the OPA cannot close down at that moment.
  1422. You should use LOCK ON if your OPA uses a command, such as EDIT, MENU or DIALOG, which accesses the keyboard. You might also use it when the OPA is about to go busy for a considerable length of time, or at any other point where a clean exit is not possible. Do not forget to use LOCK OFF as soon as possible afterwards.
  1423. An OPA is initially unlocked.
  1424. AOpens the device to which LPRINTs are to be sent.
  1425. No LPRINTs can be sent until a device has been opened with LOPEN.
  1426. Youu can open any of these devices:
  1427. - The serial port, with LOPEN "TTY:A"
  1428. - A file on the Psion
  1429. Any existing file of the name given will be overwritten when you print to it.
  1430. Only one device may be open at any one time. Use LCLOSE to close the device. (It also closes automatically when a program finishes running.)
  1431. See Appendix C.
  1432. BPrints a list of items, in the same way as PRINT, except that the data is sent to the device most recently opened with LOPEN.
  1433. The expressions may be quoted strings, variables, or the evaluated results of expressions. The punctuation of the LPRINT statement (commas, semicolons and new lines) determines the layout of the printed text, in the same way as PRINT statements.
  1434. If no device has been opened with LOPEN you will get an error.
  1435. See PRINT for displaying to the screen.
  1436. See LOPEN for opening a device for LPRINT.
  1437. See Appendix C for an overview of printing from OPL. See also Printer OPX in the 'Using OPXs on the Series 5' chapter for details of more advanced printing features.
  1438. AReturns the greatest of a list of numeric items.
  1439. The list can be either:
  1440. A list of variables, values and expressions, separated by commas
  1441. The elements of a floating-point array.
  1442. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MAX(arr(),3) would return the value of the largest of elements arr(1), arr(2) and arr(3).
  1443. ECreates a cascade for a menu, on which less important menu items can be displayed. The cascade must be defined before use in a menu card. For example, a 'Bitmap' cascade under the File menu of a possible OPL drawing application could be defined like this:
  1444. mCASC "Bitmap","Load",%L,"Merge",%M
  1445. mCARD "File","New",%n,"Open",%o,"Save",%s,"Bitmap>",16,"Exit",%e
  1446. The trailing > character specifies that a previously defined cascade item is to be used in the menu at this point: it is not displayed in the menu item. A cascade has a filled arrow head displayed along side it in the menu. The cascade title in mCASC is also used only for identification purposes and is not displayed in the cascade itself. This title needs to be identical to the menu item text apart from the >. For efficiency, OPL doesn't check that a defined cascade has been used in a menu and an unused cascade will simply be ignored. To display a > in a cascaded menu item, you can use >>.
  1447. Shortcut keys used in cascades may be added to the appropriate constant values as for mCARD to enable checkboxes, option buttons and dimming of cascade items.
  1448. As is typical for cascade titles, a shortcut value of 16 is used in the example above. This prevents the display or specification of any shortcut key. However, it is possible to define a shortcut key for a cascade title if required, for example to cycle through the options available in a cascade.
  1449. See mCARD, MENU, mINIT.
  1450. /BReturns the arithmetic mean (average) of a list of numeric items.
  1451. The list can be either:
  1452. A list of variables, values and expressions, separated by commas
  1453. The elements of a floating-point array.
  1454. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MEAN(arr(),3) would return the average of elements arr(1), arr(2) and arr(3).
  1455. This example displays 15.0:
  1456. a(1)=10
  1457. a(2)=15
  1458. a(3)=20
  1459. PRINT MEAN(a(),3)
  1460. @Displays the menus defined by mINQ
  1461. IT, mCARD and mCASC, and waits for you to select an item. Returns the shortcut key keycode of the item selected, as defined in mCARD, in lower case.
  1462. If you cancel the menu by pressing Esc, MENU returns 0.
  1463. If the name of a variable is passed, it sets the initial menu pane and item to be highlighted. init% should be 256*(menu%)+item%; for both menu% and item%, 0 specifies the first, 1 the second and so on. If init% is 517 (=256*2+5), for example, this specifies the 6th item on the third menu.
  1464. If init% was passed, MENU writes back to init% the value for the item which was last highlighted on the menu. You can then use this value when calling the menu again.
  1465. It is necessary to use MENU(init%), passing back the same variable each time the menu is opened  if you wish the menu to reopen with the highlight set on the last selected item.
  1466. On the Series 5, it is incorrect to ignore mCARD and mCASC errors by having an ONERR label around an mCARD or mCASC call. If you do, the menu is discarded and a 'Structure fault' will be raised on using mCARD, mCASC or MENU without first using mINIT again.
  1467. The following bad code will not display the menu:
  1468. mINIT
  1469. ONERR errIgnore1
  1470. mCARD "Xxx","ItemA",0    REM bad shortcut
  1471. errIgnore1::
  1472. ONERR errIgnore2
  1473. mCARD "Yyy",""        REM 'Structure fault' error (mINIT discarded)
  1474. errIgnore2::
  1475. ONERR OFF
  1476. MENU                REM 'Structure fault' again
  1477. AReturns the smallest of a list of numeric items.
  1478. The list can be either:
  1479. A list of variables, values and expressions, separated by commas
  1480. The elements of a floating-point array.
  1481. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MIN(arr(),3) would return the minimum of elements arr(1), arr(2) and arr(3).
  1482. APrepares for definition of menus, cancelling any existing menus. Use mCARD and mCASC (on the Series 5 only) to define each menu, then MENU to display them.
  1483. On the Series 5, it is incorrect to ignore mCARD or mCASC errors by having  an ONERR label around an mCARD or mCASC call. If you do, the menu is discarded and a 'Structure fault' will be raised if there is an occurrence of mCARD, mCASC or MENU without first using mINIT again.  See also MENU for an example of this.
  1484. DPresents a popup menu. mPOPUP returns the value of the keypress used to exit the popup menu, this being 0 if Esc is pressed.
  1485. !    Note that mPOPUP defines and presents the menu itself, and should not and need not be called from inside the mINIT
  1486. MENU structure.
  1487. posType% is the position type controlling which corner of the popup menu x%,y% specifies and can take the values,
  1488. posType%    corner
  1489. 0              top left
  1490. 1              top right
  1491. 2              bottom left
  1492. 3              bottom right
  1493. Constants for these corner values are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  1494. item$ and key% can take the same values as for mCARD, with key% taking the same constant values to specify checkboxes, option buttons and dimmed items. However, cascades in popup menus are not supported.
  1495. For example
  1496. mPOPUP (0,0,0,"Continue",%c,"Exit",%e)
  1497. specifies a popup menu with 0,0 as its top left-hand corner with the items 'Continue' and 'Exit', with the shortcut keys Ctrl+C and Ctrl+E respectively.
  1498. See also mCARD.
  1499. "BReturns a string representation of the integer part of the floating-point number x, rounded to the nearest whole number. The string will be up to y% characters wide.
  1500. If y% is negative then the string is right-justified for example NUM$(1.9,-3) returns  "  2" where there are two spaces to the left of the 2.
  1501. If y% is positive no spaces are added: e.g. NUM$(-3.7,3) returns "-4".
  1502. If the string returned to n$ will not fit in the width y%, then the string will just be asterisks; for example NUM$(256.99,2) returns "**".
  1503. See also FIX$, GEN$, SCI$.
  1504. jCSwitches the Psion off.
  1505. When you switch back on, the statement following the OFF command is executed, for example:
  1506. OFF :PRINT "Hello again"
  1507. If you specify an integer, x%, greater than 2 (between 2 and 16383 on the Series 3c; 16383 is about 4.5
  1508. hours), the machine switches off for that number of seconds and then automatically turns back on and continues with the next line of the program. However, during this time the machine may be switched on by an alarm, and of course you can turn it on as usual.
  1509. The minimum time to switch off is 5 seconds on the Series 5. EPOC32 also prevents switch off if there's an absolute timer outstanding and due to go off in less than 5 seconds.
  1510. !    Be careful how you use this command. If, due to a programming mistake, a program uses OFF in a loop, you may find it impossible to switch the Psion back on, and may have to reset the computer.
  1511. BONERR label:: establishes an error handler in a procedure. When an error is raised, the program jumps to the label:: instead of the program stopping and an error message being displayed.
  1512. The label may be up to 32 characters long starting with a letter or an underscore.
  1513. It ends with a double colon (::), although you don't need to use this in the ONERR statement.
  1514. ONERR OFF disables the ONERR command, so that any errors occurring after the ONERR OFF statement no longer jump to the label.
  1515. It is advisable to use the command ONERR OFF immediately after the label:: which starts the error handling code.
  1516. See the 'Error Handling' chapter for full details.
  1517. GOpens an existing table (or a 'view' of a table) from an existing database, giving it the logical view name log and handles for the fields f1, f2. log can be any letter in the range A to Z.
  1518. query$ specifies the database file, the required table and fields to be selected.
  1519. For example:
  1520. OPEN "clients SELECT name, tel FROM phone",D,n$,t$
  1521. The database name here is clients and the table name is phone. The field names are enclosed by the keywords SELECT and FROM and their types should correspond with the list of handles  (i.e. n$ indicates that the name field is a string).
  1522. Replacing the list of field names with * selects all the fields from the table.
  1523. query$ is also used to specify an ordered view and if a suitable index has been created, then it will be used. See the 'Database OPX' section in the 'Using OPXs on the Series 5' chapter. For example,
  1524. OPEN "people SELECT name,number FROM phoneBook ORDER BY name ASC, number DESC",G,n$,num%
  1525. would open a view with name fields in ascending alphabetical order and if any names were the same then the number field would be used to order these records in descending numerical order.
  1526. If the specification of the database includes embedded spaces, for example in the name of the folder, the name must be enclosed in quotes, so for example the following correctly fails:
  1527. OPEN "c:\folder with spaces\file with spaces",a,name$
  1528. whereas the following works:
  1529. OPEN """c:\folder with spaces\file with spaces""",a,name$
  1530. Compatibility with the Series 3c
  1531. As on the Series 3c, query$ may contain just the filename. In this case a table with the default name Table1 would be opened if it exists. The field names would then be unimportant as access will be given to as many fields as there are supplied handles. The type indicators on the field handles must match the types of the fields.
  1532. See also the 'Data File Handling' chapter and the 'Series 5 Database Handling' chapter.
  1533. See also CREATE, USE and OPENR.
  1534. .MENU _menu
  1535. val%=MENU
  1536. val%=MENU(var init%)
  1537. .MID$ _string
  1538. m$=MID$(a$,x%,y%)
  1539. Returns a string comprising y% characters of a$, starting at the character at position x%.
  1540. E.g. if name$="McConnell" then MID$(name$,3,4) would return the string Conn.
  1541. .MIN _math
  1542. #m=MIN(list)
  1543. m=MIN(array(),element)
  1544. .mINIT _menu
  1545. mINIT
  1546. .MINUTE _time
  1547. m%=MINUTE
  1548. eReturns the current minute number from the system clock (0 to 59).
  1549. E.g. at 8.54am MINUTE returns 54.
  1550. .MKDIR _dir
  1551. MKDIR name$
  1552. Creates a new folder/directory.
  1553. For example, MKDIR "C:\MINE\TEMP" creates a C:\MINE\TEMP folder, also creating C:\MINE if it is not already there.
  1554. .MODIFY _data
  1555. MODIFY
  1556. Allows the current record of a view to be modified without moving the record. The fields can then be assigned to before using PUT or CANCEL.
  1557. .MONTH _date
  1558.     m%=MONTH
  1559. Returns the current month from the system clock as an integer between 1 and 12.
  1560. E.g. on 12th March 1992 m%=MONTH returns 3 to m%.
  1561. .MONTH$ _date
  1562. m$=MONTH$(x%)
  1563. Converts x%, a number from 1 to 12, to the month name, expressed as a three-letter mixed case string.
  1564. E.g. MONTH$(1) returns the string Jan.
  1565. .mPOPUP _menu
  1566. 5mPOPUP(x%,y%,posType%,item1$,key1%,item2$,key2%,...)
  1567. .NEXT _data
  1568. Positions to the next record in the current data file.
  1569. If NEXT is used after the end of a file has been reached, no error is reported but the current record is null and the EOF function returns true.
  1570. .NUM$ _convert
  1571. n$=NUM$(x,y%)
  1572. OFF x%
  1573. .ONERR _error
  1574. .ONERR label  or  ONERR label::
  1575. ONERR OFF
  1576. .OPEN _data
  1577. OPEN query$,log,f1,f2,...
  1578. .OPENR _data
  1579. OPEN query$,log,f1,f2,...
  1580. This command works exactly like OPEN except that the opened file is read-only - in other words, you cannot APPEND, UPDATE or PUT the records it contains.
  1581. This means that you can run two separate programs at the same time, both sharing the same file.
  1582. CPauses the program for a certain time, depending on the value of x%:
  1583. x%            result
  1584. 0            waits for a key to be pressed.
  1585. +ve            pauses for x% twentieths of a second.
  1586. -ve            pauses for x% twentieths of a second or until a key is pressed.
  1587. So PAUSE 100 would make the program pause for 100/20 = 5 seconds, and PAUSE -100 would make the program pause for 5 seconds or until a key is pressed.
  1588. If x% is less than or equal to 0, a GET, GET$, KEY or KEY$ will return the key press which terminated the pause. If you are not interested in this keypress, but in the one which follows it, clear the buffer after the PAUSE with a single KEY function: PAUSE -10 :KEY
  1589. You should be especially careful about this if x% is negative, since then you cannot tell whether the pause was terminated by a keypress or by the time running out.
  1590. PAUSE should not be used in conjunction with GETEVENT or GETEVENT32 because events are discarded by PAUSE.
  1591. CReturns a full file specification from the filename f$, filling in any missing information from rel$.
  1592. The offsets to the filename components in the returned string is returned in off%() which must be declared with at least 6 integers:
  1593. off%(1)    filing system offset (1 always)
  1594. off%(2)    device offset (1 always on Series 5 since filing system is not a component of filenames on the Series 5)
  1595. off%(3)    path offset
  1596. off%(4)    filename offset
  1597. off%(5)    file extension offset
  1598. off%(6)    flags for wildcards in returned string
  1599. The flag values in offset%(6) are:
  1600. 0              no wildcards
  1601. 1             wildcard in filename
  1602. 2             wildcard in file extension
  1603. 3             wildcard in both
  1604. If rel$ is not itself a complete file specification, the current filing system, device and/or path are used as necessary to fill in the missing parts.
  1605. f$ and rel$ should be separate strings.
  1606. Example:
  1607. p$=PARSE$("NEW","C:\Documents\*.MBM",x%())
  1608. sets p$ to C:\Documents\NEW.MBM and x%() to (1,1,3,14,17,0).
  1609. FThe PEEK functions find the values stored in specific bytes.
  1610.     p%=PEEKB(x&)
  1611. Returns the integer value of the byte at address x&
  1612.     p%=PEEKW(x&)
  1613. Returns the integer at address x&
  1614.     p&=PEEKL(x&)
  1615. Returns the long integer value at address x&
  1616.     p=PEEKF(x&)
  1617. Returns the floating-point value at address x&
  1618.     p$=PEEK$(x&)
  1619. Returns the string at address x&
  1620. Usually you would find out the byte address with the ADDR function. For example, if var% has the value 7, PEEKW(ADDR(var%)) returns 7.
  1621. The different types are stored in different ways across bytes:
  1622. 41    Integers are stored in two bytes. The first byte is the least significant byte, for example:
  1623. 1   0         = 1
  1624. 0   1            = 256
  1625. ADDR returns the address of the first (least significant) byte.
  1626. Long integers are stored in four bytes, the least significant first and the most significant last, for example:
  1627. 0   0   1   0    = 65536
  1628. ADDR returns the address of the first (least significant) byte.
  1629. Strings are stored with one character per byte, with a leading byte containing the string length, e.g.:
  1630. 3   65  66  67    = "ABC"
  1631. Each letter is stored as its character code - for example, A as 65.
  1632. For example, if var$="ABC", PEEK$(ADDR(var$)) will return the string ABC. ADDR returns the address of the length byte.
  1633. Floating-point numbers are stored under IEEE format, across eight bytes. PEEKF automatically reads all eight bytes and returns the number as a floating-point. For example if var=1.3 then PEEKF(ADDR(var)) returns 1.3.
  1634. You can use ADDR to find the address of the first element in an array, for example ADDR(x%(), you can also specify individual elements of the array, for example ADDR(x%(2)).
  1635. See also the POKE commands and ADDR. See also the 'Series 5 32-bit addressing' section in the 'Advanced Topics' chapter.
  1636. CFilters pointer events in the current window out or back in. Add the following flags together to achieve the desired filter% and mask%:
  1637. event        value
  1638. none        0
  1639. enter/exit    1
  1640. drag        4
  1641. Constants for these values are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  1642. The bits set in filter% specify the settings to be used, 1 to filter out the event and 0 to remove the filter. Only those bits set in mask% will be used for filtering.  This allows the current setting of a particular bit to be left unchanged if that bit is zero in the mask. (i.e. mask% dictates what to change and filter% specifies the setting to which it should be changed). For example,
  1643. mask%=5
  1644. REM  =1+4 - allows enter/exit and drag settings to be changed
  1645. POINTERFILTER 1,mask% REM filters out enter/exit, but not dragging
  1646. POINTERFILTER 4,mask% REM filters out drag and reinstates enter/exit
  1647. Initially the events are not filtered out.
  1648. See also GETEVENT32, GETEVENTA32.
  1649. 5DReturns the number of the current record in the current view.  You are advised to use bookmarks instead of POS on the Series 5.
  1650. A Series 5 file has no limit on the number of records and Series 3c files can have up to 65534 records. However, integers can only be in the range -32768 to +32767. Record numbers above 32767 are therefore returned like this:
  1651. record    value        returned by POS
  1652. 32767                 32767
  1653. 32768                 -32768
  1654. 32769                -32767
  1655. 32770                -32766
  1656. .                .
  1657. 65534                -2
  1658. To display record numbers, you can use this check:
  1659. IF POS<0
  1660. PRINT 65536+POS
  1661. PRINT POS
  1662. ENDIF
  1663. Note that on the Series 5 the number of the current record may be greater than or equal to 65535 and hence values may need to be truncated to fit into p%, giving inaccurate results. You are particuarly advised to use bookmarks when dealing with a large number of records. Note, however, that the value returned by POS can become inaccurate if used in conjunction with bookmarks and multiple views on a table. Accuracy can be restored by using FIRST or LAST on the current view.
  1664. See BOOKMARK, GOTOMARK, KILLMARK.
  1665. oBMakes record number x% the current record in the current view.  By using bookmarks and editing the same table via different views, positional accuracy can be lost and POSITION x% could access the wrong record. Accuracy can be restored by using FIRST or LAST on the current view.
  1666. POS and POSITION still exist mainly for reasons of compatibility with the Series 3c and you are advised to use bookmarks instead on the Series 5.
  1667. See BOOKMARK, GOTOMARK, KILLMARK.
  1668. Makes record number x% the current record in the current data file.
  1669. If x% is greater than the number of records in the file then the EOF function will return true.
  1670. @Displays a list of expressions on the screen. The list can be punctuated in one of these ways:
  1671. If items to be displayed are separated by commas, there is a space between them when displayed.
  1672. If they are separated by semicolons, there are no spaces.
  1673. Each PRINT statement starts a new line, unless the preceding PRINT ended with a semicolon or comma.
  1674. There can be as many items as you like in this list. A single PRINT on its own just moves to the next line.
  1675. Examples: On 1st January 1993,
  1676. code                        display
  1677. PRINT "TODAY is",            
  1678. PRINT DAY;".";MONTH;".";YEAR        TODAY is 1.1.1993
  1679. PRINT 1                       1
  1680. PRINT "Hello"                    Hello
  1681. PRINT "Number",1              Number 1
  1682. See also LPRINT, gUPDATE, gPRINT, gPRINTB, gPRI
  1683. NTCLIP, gXPRINT.
  1684. AConverts x from degrees to radians.
  1685. All the trigonometric functions assume angles are specified in radians, but it may be easier for you to enter angles in degrees and then convert with RAD.
  1686. Example:
  1687. PROC xcosine:
  1688. LOCAL angle
  1689. PRINT "Angle (degrees)?:";
  1690. INPUT angle
  1691. PRINT "COS of",angle,"is",
  1692. angle=RAD(angle)
  1693. PRINT COS(angle)
  1694. (The formula used is (PI*x)/180).
  1695. To convert from radians to degrees use DEG.
  1696. `ARaises an error.
  1697. The error raised is error number x%. This may be one of the errors listed in the 'Error Handling' chapter, or a new error number defined by you.
  1698. The error is handled by the error processing mechanism currently in use 
  1699.  either OPL's own, which stops the program and displays an error message, or the ONERR handler if you have ONERR on.
  1700. BGives a 'seed' (start-value) for RND.
  1701. Successive calls of the RND function produce a sequence of random numbers. If you use RANDOMIZE to set the seed back to what it was at the beginning of the sequence, the same sequence will be repeated.
  1702. For example, you might want to use the same 'random' values to test new versions of a procedure. To do this, precede the RND statement with the statement RANDOMIZE value. Then to repeat the sequence, use RANDOMIZE value again.
  1703. Example:
  1704. PROC SEQ:
  1705. LOCAL g$(1)
  1706. WHILE 1
  1707. PRINT "S: set seed to 1"
  1708. PRINT "Q: quit"
  1709. PRINT "other key: continue"
  1710. g$=UPPER$(GET$)
  1711. IF g$="Q"
  1712. BREAK
  1713. ELSEIF g$="S"
  1714. PRINT "Setting seed to 1"
  1715. RANDOMIZE 1
  1716. PRINT "First random no:"
  1717. PRINT "Next random no:"
  1718. ENDIF
  1719. PRINT RND
  1720. ENDWH
  1721. )BChange the size of a previously allocated cell at pcell& (pcell%) to size& (size%), returning the new cell address or zero if there is not enough memory.
  1722. Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.
  1723. See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.
  1724. See also the 'Advanced Topics' chapter.
  1725. ;ARenames file1$ as file2$. You can rename any type of file.
  1726. You cannot use wildcards.
  1727. You can rename across directories RENAME "\dat\xyz.abc","\xyz.abc" is OK. If you do this, you can choose whether or not to change the name of the file.
  1728. Example:
  1729. PRINT "Old name:" :INPUT a$
  1730. PRINT "New name:" :INPUT b$
  1731. RENAME a$,b$
  1732. xHBnv:Nd
  1733. Rn2\[
  1734. .PARSE$ _dir _file
  1735. p$=PARSE$(f$,rel$,var off%())
  1736. .PAUSE _control
  1737.     PAUSE x%
  1738. .PEEK functions _mem
  1739. .PI _math
  1740. $Returns the value of pi (3.14... ).
  1741. .POINTERFILTER _pen
  1742. POINTERFILTER filter%,mask%
  1743. .POS _data
  1744. p%=POS
  1745. .POSITION _data
  1746. POSITION x%
  1747. .PRINT _text
  1748. PRINT list of expressions
  1749. .PUT _data
  1750. rMarks the end of a database's INSERT or MODIFY phase and makes the changes permanent.
  1751. See INSERT, MODIFY, CANCEL.
  1752. .RAD _conv
  1753.     r=RAD(x)
  1754. .RAISE _error
  1755.     RAISE x%
  1756. .TRAP RAISE _error
  1757. TRAP RAISE x%
  1758. Sets the value of ERR to x% and clears the trap flag.
  1759. For a full explanation of the use of RAISE, see the 'Error Handling' chapter.
  1760. .RANDOMIZE _math
  1761. RANDOMIZE x&
  1762. .REALLOC _mem
  1763. pcelln&=REALLOC(pcell&,size&)
  1764.     REM text
  1765. .RENAME _file
  1766. RENAME file1$,file2$
  1767. ATerminates the execution of a procedure and returns control to the point where that procedure was called (ENDP does this automatically).
  1768. RETURN variable does this as well, but also passes the value of variable back to the calling procedure. The variable may be of any type. You can return the value of any single array element - for example RETURN x%(3). You can only return one variable.
  1769. RETURN on its own, and the default return through ENDP, causes the procedure to return the value 0 or a null string.
  1770. @BReturns a random floating-point number in the range 0 (inclusive) to 1 (exclusive).
  1771. To produce random numbers between 1 and n e.g. between 1 and 6 for a dice use the following statement: f%=1+INT(RND*n)
  1772. RND produces a different number every time it is called within a program. A fixed sequence can be generated by using RANDOMIZE. You might begin by using RANDOMIZE with an argument generated from MINUTE and SECOND (or similar), to seed the sequence differently each time.
  1773. Example:
  1774. PROC rndvals:
  1775. LOCAL i%
  1776. PRINT "Random test values:"
  1777. PRINT RND
  1778. i%=i%+1
  1779. UNTIL i%=10
  1780. yAReturns a string representation of x in scientific format, to y% decimal places and up to z% characters wide.
  1781. Examples:
  1782. SCI$(123456,2,8)="1.23E+05"
  1783. SCI$(1,2,8)="1.00E+00"
  1784. SCI$(1234567,1,-8)=" 1.2E+06"
  1785. If the number does not fit in the width specified then the returned string contains asterisks.
  1786. If z% is negative then the string is right-justified.
  1787. See also FIX$, GEN$, NUM$.
  1788. AChanges the size of the window in which text is displayed. x%,y% specify the character position of the top left corner; if they are not given, the text window is centred in the screen.
  1789. An OPL program can initially display text to the whole screen.
  1790. See SCREENINFO.
  1791. EGets information on the text screen (as used by PRINT, SCREEN etc.)
  1792. This keyword allows you to mix text and graphics. It is required because while the default window is the same size as the physical screen, the text screen is slightly smaller and is centred in the default window. The few pixels gaps around the text screen, referred to as the left and top margins, depend on the font in use.
  1793. On return, the array info%(), which must have at least 10 elements, contains this information:
  1794. info%(1) left margin in pixels
  1795. info%(2) top margin in pixels
  1796. info%(3) text screen width in character units
  1797. info%(4) text screen height in character units
  1798. info%(5) reserved (window server id for default window)
  1799. The font ID is a 32-bit integer on the Series 5 and therefore would not fit into a single element of info%().  Hence, the least significant 16 bits of the font ID are returned to info%(9) and the most significant 16 bits to info%(10).
  1800. info%(6) unused
  1801. info%(7) pixel width of text window character cell
  1802. info%(8) pixel height of text window line
  1803. info%(9) least significant 16 bits of the font ID
  1804. info%(10) most significant 16 bits of the font ID
  1805. Initially SCREENINFO returns the values for the initial text screen. Subsequently any keyword which changes the size of the text screen font, such as FONT or SCREEN, will change some of these values and SCREENINFO should therefore be called again.
  1806. See also FONT, SCREEN.
  1807. IASets the variables passed by reference to the date corresponding to s&, the number of seconds since 00:00 on 1/1/1970. yrday% is set to the day in the year (1-366).
  1808. s& is an unsigned long integer. To use values greater than +2147483647, subtract 4294967296 from the value.
  1809. See also DATETOSECS, HOUR, MINUTE, SECOND, dDATE, DAYS.
  1810. DLSets the file file$ to be a document.  This command should be called immediately before the creation of file$ if it is to be recognised as a document. SETDOC may be used with the commands CREATE, gSAVEBIT and IOOPEN.
  1811. The string passed to SETDOC must be identical to the name passed to the following CREATE or gSAVEBIT otherwise a non-document file will be created. Example of document creation:
  1812. SETDOC "myfile"
  1813. CREATE "myfile",a,a$,b$
  1814. SETDOC should also be called after successfully opening a document to allow the System screen to display the correct document name in its task list.
  1815. In case of failure in creating or opening the required file, you should take the following action:
  1816. Creating - try to re-open the last file and if this fails display an appropriate error dialog and exit. On reopening, call SETDOC back to the original file so the Task list is correct.
  1817. Opening - as for creating, but calling SETDOC again is not strictly required.
  1818. Database documents, created using CREATE, and multi-bitmap documents, created using gSAVEBIT, will automatically contain your application UID in the file header. For binary and text file documents created using IOOPEN and LOPEN, it is the programmer's responsibility to save the appropriate header in the file. This is a fairly straight-forward process and the following suggests one way of finding out what the header should be:
  1819. 1. Create a database or bitmap document in a test run of you application using SETDOC as shown above
  1820. 2. Use a hex editor or hex dump program to find the 1st 16 bytes, or run the program below which reads the four long integer UIDs from the test document.
  1821. 3. Write these four long integers to the start of the file you create using IOOPEN.
  1822. INCLUDE "Const.oph"
  1823. DECLARE EXTERNAL
  1824. EXTERNAL readUids:(file$)
  1825. PROC main:
  1826. LOCAL f$(255)
  1827. WHILE 1
  1828. dINIT "Show UIDs in document header"
  1829. dPOSITION 1,0
  1830. dFILE f$,"Document,Folder,Drive",0
  1831. IF DIALOG=0
  1832. RETURN
  1833. ENDIF
  1834. readUids:(f$)
  1835. ENDWH
  1836. PROC readUids:(file$)
  1837. LOCAL ret%,h%
  1838. LOCAL uid&(4),i%
  1839. ret%=IOOPEN(h%,file$, KIoOpenModeOpen% OR KIoOpenFormatBinary%)
  1840. IF ret%>=0
  1841. ret%=IOREAD(h%,ADDR(uid&()),16)
  1842. PRINT "Reading ";file$
  1843. IF ret%=16
  1844. WHILE i%<4
  1845. i%=i%+1
  1846. print "  Uid"+num$(i%,1)+"=",hex$(uid&(i%))
  1847. ENDWH
  1848. PRINT "  Error reading: ";
  1849. IF ret%<0
  1850. PRINT err$(ret%)
  1851. PRINT "Read ";ret%;" bytes only (4 long integers required)"
  1852. ENDIF
  1853. ENDIF
  1854. IOCLOSE(h%)
  1855. PRINT "Error opening: ";ERR$(ret%)
  1856. ENDIF
  1857. Creating text file documents using IOOPEN or LOPEN has two special requirements:
  1858. * You will need to save the required header as the first text record. This will insert the standard text file line delimiters CR LF (hex 0D 0A) at the end of the record.
  1859. * The specific 16 bytes required for your application may itself however contain CR LF. Since you should know when this is the case, you will need to read records until you have reached byte 16 in the document. This is clearly not a desirable state of affairs but is inescapable given that text files were not designed to have headers. It is recommended that you request a new UID for your application if it contains CR LF.
  1860. See the 'Advanced Topics' chapter.
  1861. See also GETDOC$.
  1862. DSets flags to produce various effects when running programs. Use CLEARFLAGS to clear any flags which have been set.  The effects which can be achieved are as follows:
  1863. flags&    effect
  1864. 1    restricts the memory available to your application to 64K, emulating the Series 3c. This setting should be used at the beginning of your program only, if required. Changing this setting repeatedly will have unpredictable effects.
  1865. 2    enables auto-compaction on closing databases. This can be slow, but it is advisable to use this setting when lots of changes have been made to a database.
  1866. 4    enables raising of overflow errors when floating-point values are greater than or equal to 1.0E+100 in magnitude, instead of allowing 3-digit exponents (for backwards compatibility).
  1867. $10000    enables GETEVENT, GETEVENT32 and GETEVENT32A to return the event code $403 to ev&(1) when the machine switches on
  1868. Constants for these flags are supplied in Const.oph. See the 'Calling Procedures' chapter for details of how to use this file and Appendix E for a listing of it.
  1869. By default these flags are cleared.
  1870. See the 'Advanced Topics' and 'Series 5 Database Handling' chapters.
  1871. See also GETEVENT32, CLEARFLAGS.
  1872. iAReturns the number of free bytes on the device on which the current (open) data file is held.
  1873. Example:
  1874. PROC stock:
  1875. OPEN "c:\stock\stock",A,a$,b%
  1876. PRINT SPACE,"bytes free on C:"
  1877. PROC stock:
  1878. OPEN "a:\stock",A,a$,b%
  1879. WHILE 1
  1880. PRINT "Item name:";
  1881. INPUT A.a$
  1882. PRINT "Number:";
  1883. INPUT A.b%
  1884. IF RECSIZE>SPACE
  1885. PRINT "Disk full"
  1886. CLOSE
  1887. BREAK
  1888. APPEND
  1889. ENDIF
  1890. ENDWH
  1891. .REPT$ _string
  1892. r$=REPT$(a$,x%)
  1893. nReturns a string comprising x% repetitions of a$.
  1894. For example, if a$="ex", r$=REPT$(a$,5) returns exexexexex.
  1895. .RETURN _control
  1896. RETURN
  1897. RETURN variable
  1898. .RIGHT$ _string
  1899. r$=RIGHT$(a$,x%)
  1900. Returns the rightmost x% characters of a$.
  1901. Example:
  1902. PRINT "Enter name/ref",
  1903. INPUT c$
  1904. ref$=RIGHT$(c$,4)
  1905. name$=LEFT$(c$,LEN(c$)-4)
  1906. .ROLLBACK _data
  1907.     ROLLBACK
  1908. Cancels the current transaction on the current view. Changes made to the database with respect to this particular view since BEGINTRANS was called will be discarded.
  1909. See also BEGINTRANS, COMMITTRANS.
  1910. .RMDIR _file _dir
  1911. RMDIR str$
  1912. LRemoves the directory given by str$. You can only remove empty directories.
  1913. .RND _math
  1914. r=RND
  1915. .SCI$ _conv
  1916. s$=SCI$(x,y%,z%)
  1917. .SCREEN _text _win
  1918. 2SCREEN width%,height%
  1919. SCREEN width%,height%,x%,y%
  1920. .SCREENINFO _text _win _font
  1921. SCREENINFO var info%()
  1922. .SECOND _time
  1923. s%=SECOND
  1924. hReturns the current time in seconds from the system clock (0 to 59).
  1925. E.g. at 6:00:33 SECOND returns 33.
  1926. .SECSTODATE _date _time
  1927. ISECSTODATE s&,var yr%,var mo%,var dy%,var hr%,var mn%,var sc%,var yrday%
  1928. .SETDOC _data
  1929. SETDOC file$
  1930. .SETFLAGS _opa
  1931. SETFLAGS flags&
  1932. .SETPATH _dir _file
  1933. SETPATH name$
  1934. Sets the current path for file access for example,
  1935.     SETPATH "C:\documents\".
  1936. LOADM continues to use the path of the initial program, but all other file access will use the new path.
  1937. .SIN _math
  1938. s=SIN(angle)
  1939. tReturns the sine of angle, an angle expressed in radians.
  1940. To convert from degrees to radians, use the RAD function.
  1941. .SPACE _mem
  1942.     s&=SPACE
  1943. BReturns the standard deviation of a list of numeric items.
  1944. The list can be either:
  1945. * A list of variables, values and expressions, separated by commas
  1946. * The elements of a floating-point array.
  1947. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=STD(arr(),3) would return the standard deviation of elements arr(1), arr(2) and arr(3).
  1948. This function gives the sample standard deviation, using the formula:
  1949. where  means . To convert to population standard deviation, multiply the result by SQR((n-1)/n).
  1950. AReturns the sum of a list of numeric items.
  1951. The list can be either:
  1952. A list of variables, values and expressions, separated by commas
  1953. The elements of a floating-point array.
  1954. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=SUM(arr(),3) would return the sum of elements arr(1), arr(2) and arr(3)
  1955. yAReturns 'True' if an event has occurred, otherwise returns 'False'. The event is not read by TESTEVENT - it may be read with GETEVENT, or GETEVENT32 or GETEVENTA32 on the Series
  1956. !    On the Series 5, it is recommended that you use either GETEVENT32 or GETEVENTA32 without TESTEVENT as TESTEVENT may use a lot of power, especially when used in a loop as will often be the case.
  1957. BTRAP is an error handling command. It may precede any of these commands:
  1958. Data file commands
  1959. APPEND, UPDATE, BACK, NEXT, LAST, FIRST, POSITION, USE, CREATE, OPEN, OPENR, CLOSE, DELETE,MODIFY, INSERT, PUT, CANCEL
  1960. File commands
  1961. COPY, ERASE, RENAME, LOPEN, LCLOSE, LOADM, UNLOADM
  1962. Directory commands
  1963. MKDIR, RMDIR
  1964. Data entry commands
  1965. EDIT, INPUT
  1966. Graphics commands
  1967. gSAVEBIT, gCLOSE, gUSE, gUNLOADFONT, gFONT, gPATT, gCOPY
  1968. For example, TRAP FIRST.
  1969. Any error resulting from the execution of the command will be trapped. Program execution will continue at the statement after the TRAP statement, but ERR will be set to the error code.
  1970. TRAP overrides any ONERR.
  1971. BAdd val1% and val2%, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic on the Series 3c e.g. UADD(ADDR(text$),1) should be used instead of ADDR(text$)+1.
  1972. One argument would normally be a pointer and the other an offset expression.
  1973. Note that UADD and USUB should not be used on the Series 5 for pointer arithmetic unless SETFLAGS has been used to enforce the 64K memory limit. In general, long intger arithmetic should be used for pointer arithmetic on the Series 5.
  1974. See also USUB.
  1975. @Removes from memory the module module$ loaded with LOADM.
  1976. module$ is a string containing the name of the translated module.
  1977. The procedures in an unloaded module cannot then be called by another procedure.
  1978. UNLOADM causes any procedures in the module that are not still running to be unloaded from memory too. Running procedures are unloaded on return. It is considered bad practice, however, to use UNLOADM on a module with procedures that are still running.
  1979. Once LOADM has been called, procedures loaded stay in memory until the module is
  1980.  unloaded, so significantly more memory can be used than on the Series 3c, where procedures are unloaded when the cache is full (or on return if caching is not used).
  1981. }ADeletes the current record in the current data file and saves the current field values as a new record at the end of the file.
  1982. This record, now the last in the file, remains the current record.
  1983. Example:
  1984. A.count=129
  1985. A.name$="Brown"
  1986. UPDATE
  1987. Use APPEND to save the current field values as a new record.
  1988. MODIFY, PUT and CANCEL should normally be used instead of UPDATE on the Series 5.
  1989. AConverts any lower case characters in a$ to upper case, and returns the completely upper case string.
  1990. Example:
  1991. CLS :PRINT "Y to continue"
  1992. PRINT "or N to stop."
  1993. g$=UPPER$(GET$)
  1994. IF g$="Y"
  1995. nextproc:
  1996. ELSEIF g$="N"
  1997. RETURN
  1998. ENDIF
  1999. Use LOWER$ to convert to lower case.
  2000. ^ASelects the data file with the given logical name (A-Z for the Series 5, A, B, C or D for the Series 3c). The file must previously have been opened with OPEN, OPENR or CREATE and not yet be closed.
  2001. All the record handling commands (such as POSITION and UPDATE, and GOTOMARK, INSERT, MODIFY, CANCEL and PUT on the Series 5) then operate on this file.
  2002. pASubtract val2% from val1%, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic on the Series 3c.
  2003. Note that UADD and USUB should not be used for pointer arithmetic on the Series 5 unless SETFLAGS has been used to enforce the 64K memory limit. In general long integer arithmetic should be used.
  2004. See also UADD.
  2005. AReturns the floating-point number corresponding to a numeric string.
  2006. The string must be a valid number e.g. not "5.6.7" or "196f". Expressions, such as "45.6*3.1", are not allowed. Scientific notation such as "1.3E10", is OK.
  2007. E.g. VAL("470.0") returns 470
  2008. See also EVAL.
  2009. XR@RNVX
  2010. .SQR _math
  2011.     s=SQR(x)
  2012. Returns the square root of x.
  2013. .STD _math
  2014. #s=STD(list)
  2015. s=STD(array(),element)
  2016. .STOP _control
  2017. Ends the running program.
  2018. Note that STOP may not be used during an OPX callback and will raise the Series 5 error, 'STOP used in callback' if it is. See the 'Using OPXs on the Series 5' chapter.
  2019. .STYLE _font _text
  2020. STYLE style%
  2021. Sets the text window character style. style% can be 2 for underlined, or 4 for inverse.
  2022. See 'The text and graphics windows' section at the end of the 'Graphics' chapter for more details.
  2023. .SUM _math
  2024. #s=SUM(list)
  2025. s=SUM(array(),element)
  2026. .TAN _math
  2027. t=TAN(angle)
  2028. wReturns the tangent of angle, an angle expressed in radians.
  2029. To convert from radians to degrees, use the DEG function.
  2030. .TESTEVENT _event
  2031. t%=TESTEVENT
  2032. .TRAP _error
  2033. TRAP command
  2034. .TRAP RAISE _error
  2035. TRAP RAISE x%
  2036. zSets the value of ERR to x% and clears the trap flag.
  2037. See the 'Error Handling' chapter for further details of TRAP usage.
  2038. .UADD _mem
  2039. i%=UADD(val1%, val2%)
  2040. .UNLOADM _mem
  2041. UNLOADM module$
  2042. .UPDATE _data
  2043. UPDATE
  2044. .UPPER$ _string
  2045. u$=UPPER$(a$)
  2046. .USE _data
  2047. USE logical name
  2048. .USUB _mem
  2049. i%=USUB(val1%,val2%)
  2050. .VAL _conv
  2051. v=VAL(numeric string)
  2052. eBReturns the variance of a list of numeric items.
  2053. The list can be either:
  2054. A list of variables, values and expressions, separated by commas
  2055. The elements of a floating-point array.
  2056. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=VAR(arr(),3) would return the variance of elements arr(1), arr(2) and arr(3).
  2057. This function gives the sample variance, using the formula:
  2058. where  means . To convert to population variance, multiply the result by (n-1)/n
  2059. AVECTOR i% jumps to label number i% in the list. If i% is 1 this will be the first label, and so on. The list is terminated by the ENDV statement. The list may spread over several lines, with a comma separating labels in any one line but no comma at the end of each line.
  2060. If i% is not in the range 1 to N, where N is the number of labels, the program continues with the statement after the ENDV statement.
  2061. See also GOTO.
  2062. WCReturns the week number in which the specified day falls, as an integer between 1 and 53.
  2063. day% must be between 1 and 31, month% between 1 and 12, year% between 0 and 9999 (1900 and 2155 on the Series 3c).
  2064. Each week is taken to begin on the 'Start of week' day, as specified in the Control Panel on the Series 5 or the Time application on the Series 3c. When a year begins on a different day to the start of the week, it counts as week 1 if there are four or more days before the next week starts.
  2065. The System setting of the 'Start of week' may be checked from inside OPL by using the LCSTARTOFWEEK&: procedure in the Date OPX. The week number in the year may also be calculated by different rules and also with your own choice of the start of year by using the procedure DTWEEKNOINYEAR&: in Date OPX. See the 'Using OPXs on the Series 5' for more details.
  2066. MARepeatedly performs the set of instructions between the WHILE and the ENDWH statement, so long as expression returns logical true non-zero.
  2067. If  expression is not true, the program jumps to the line after the ENDWH statement.
  2068. Every WHILE must be closed with a matching ENDWH.
  2069. See also DO...UNTIL and the 'Loops and Branches' chapter.
  2070. BThe POKE commands store values in specific bytes.
  2071.     POKEB x&,y%
  2072. Stores the integer value y% (less than 256) in the single byte at address x&
  2073.     POKEW x&,y%
  2074. Stores the integer y% across two consecutive bytes, with the least significant byte in the lower address, that is x&
  2075.     POKEL x&,y&
  2076. Stores the long-integer y& in bytes starting at address x&
  2077.     POKEF x&,y
  2078. Stores the floating-point value y in bytes starting at address x&
  2079.     POKE$ x&,y$
  2080. Stores the string y$ in bytes starting at address x&
  2081. Use ADDR to find out the address of your declared variables.
  2082. !    Casual use of these commands can result in the loss of data in the Series 3c.
  2083. See PEEK for more details of how the different types are stored across bytes.
  2084. ODisplays or removes a clock showing the system time. The current position in the current window is used. Only one clock may be displayed in each window.
  2085. mode% controls the type of clock.
  2086. Values are:
  2087. 6     black and grey medium, system setting
  2088. 7     black and grey medium, analog
  2089. 8     second type medium, digital
  2090. 9     black and grey extra large
  2091. 11    formatted digital (described below)
  2092. On the Series 5, there are additional features on the basic clocks which partially replace these effects.  The digital clock (mode%=8) automatically displays the day of the week and day of  the month below the time.  The extra large analog clock (mode%=9) automatically displays a second hand.
  2093. !    Do not use gSCROLL to scroll the region containing a clock. When the time is updated, the old position would be used. The whole window may, however, be moved using gSETWIN.
  2094. Digital clocks display in 24-hour or 12-hour mode according to the system-wide setting.
  2095. offset& specifies an offset in minutes from the system time to the time displayed. This allows you to display a clock showing a time other than the system time.
  2096. On the Series 5, a flag, which has the value $100, may be ORed with mode% so that offset& may be specified in seconds rather than minutes. The offset is a long integer to enable a whole day to be specified when the offset is in seconds.
  2097. If these arguments are not supplied, mode% is taken as 1, and offset& as 0.
  2098. The system setting for the clock type (i.e. digital or analog) can be changed by an OPL program using the procedure LCSETCLOCKFORMAT: in Date OPX This is function should be used to implement, for example, tapping a toolbar clock to change its type as in the built-in Series 5 applications. See the 'Using OPXs on the Series 5' section for full details of this procedure.
  2099. format$, font% and style% are used only for formatted digital clocks (mode% 10 on the Series 3c and 11 on the Series 5). The values for font& and style% are as for gFONT and gSTYLE. The default font for gCLOCK is the system font. The default style is normal (0).
  2100. For the formatted digital clock, a format string (up to 255 characters long) specifies how the clock is to be displayed. The format string contains a number of format specifiers in the form of a % followed by a letter. (Upper or lower case may be used.)
  2101. For the Series 5, the format string may contain the following symbols to obtain the required effects:
  2102. Some examples of the use of these format strings are as follows.  The example use is 1:30:05 pm on Wednesday, 1st January 1997, with the system setting of European dates and with am/pm after the time:
  2103. 1.    "%-A%I:%T:%S%+A" will print the time in 12 hour clock, including seconds, with the am/pm either inserted before or after the time, depending on the system setting.   So the example time would appear as, 1:30:05
  2104. 2.    "%F%E %*D%X %N %Y" will print the day of the week followed by the date with suffix, the month as a word and the year.  For example, Wednesday 1st January 1997.
  2105. 3.    "%E %D%X%N%Y %1 %2 %3" will use the locale setting for ordering the elements of the date, but will use a suffix on the day and the month in words.  For example, Wednesday 01st January 1997.
  2106. 4.    "%*E %*D%X%*N%*Y %1 %2 '%3" will be similar to 3., but will abbreviate the day of the week, the day, the month and the year, so the example becomes "Wed 1st Jan 97".
  2107. 5.    "%M%Y%D%1%/0%2%/0%3" will appear as 01/01/1997.  This demonstrates that the ordering of the %D, %M and %Y is irrelevant when using localedependent formatting.  Instead the ordering of the date components is determined by the order of the %1, %2, and %3 formatting commands.
  2108. style% may take any of the values used to specify gSTYLE, other than 2 (underlined).
  2109. A note should also be made that a 'General Failure' error will result if you attempt to use an invalid format.  Invalid formats include using %: and %/ followed by 0 or 3 when in European locale setting (when these separators are without meaning) and using %+ and %- followed by characters other than A or B.
  2110. Courier New
  2111. Insert a single % character in the string
  2112. Times New Roman
  2113. Times New Roman
  2114. Abbreviate following item.  (The asterisk should be inserted between the % and the number or letter, e.g. %*1).  In most cases this amounts to omitting any leading zeros, for example if it is the first of the month 
  2115. %F %*M
  2116.  will display as 1 rather tha
  2117. Times New Roman
  2118. Times New Roman
  2119. Insert a system time separator character.  n is an integer between zero and three inclusive which indicates which time separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the hours/minutes separator and minu
  2120. Times New Roman
  2121. Times New Roman
  2122. Insert a system date separator character.  n is an integer between zero and three inclusive which indicates which date separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the day/month separator and month/ye
  2123. Times New Roman
  2124. Times New Roman
  2125. Insert the first component of a three component date (i.e. a date including day, month and year) where the order of the components is determined by the system settings. The possibilities are: dd/mm/yyyy, (European), mm/dd/yyyy (American), yyyy/mm/dd (J
  2126. Times New Roman
  2127. Times New Roman
  2128. Insert the second component of a three component date where the order has been determined by the system settings. See %1.
  2129. Times New Roman
  2130. Times New Roman
  2131. Insert the third component of a three component date where the order has been determined by the system settings. See %1.
  2132. Times New Roman
  2133. Times New Roman
  2134. Insert the first component of a two component date (i.e. a date including day and month only) where the order has been determined by system settings. The possibilities are: dd/mm, (European), mm/dd (American), mm/dd (Japanese).
  2135. Times New Roman
  2136. Times New Roman
  2137. Insert the second component of a two component date where the order has been determined by the system settings. See %4.
  2138. Times New Roman
  2139. Times New Roman
  2140. Insert am or pm according to the current language and time of day. Text is printed even if 24 hour clock is in use. Text may be specified to be printed before or after the time, and a trailing or leading space as appropriate will be added. The abbrevia
  2141. Times New Roman
  2142. Times New Roman
  2143. As %A, except that the am/pm text is only inserted if the system clock setting is 12 hour.  (This should be used in conjunction with %J. )
  2144. Times New Roman
  2145. Times New Roman
  2146. Insert the two-digit day number in month (in conjunction with %1 etc.).
  2147. Times New Roman
  2148. Times New Roman
  2149. Insert the day name. Abbreviation is language specific (3 letters in English).
  2150. Times New Roman
  2151. Times New Roman
  2152. Use this at the beginning of a format string to make the date/time formatting independent of the system setting. This fixes the order of the following day/month/year component(s) in their given order, removing the need to use %1 to %5, allowing individ
  2153. Times New Roman
  2154. Times New Roman
  2155. Insert the two-digit hour component of the time in 24 hour clock format.
  2156. Times New Roman
  2157. Times New Roman
  2158. Insert the two-digit hour component of the time in 12 hour clock format.  Any leading zero is automatically suppressed, regardless of whether an asterisk is inserted or not.
  2159. Times New Roman
  2160. Times New Roman
  2161. Insert the two-digit hour component of time in either 12 or 24 hour clock format depending on the corresponding system setting. When the clock has been set to 12 hour format, the hour
  2162. s leading zero is automatically suppressed regardless of whether an 
  2163. Times New Roman
  2164. Times New Roman
  2165. Insert the two-digit month number (in conjunction with %1 etc.).
  2166. Times New Roman
  2167. Times New Roman
  2168. Insert the month name (in conjunction with %1 etc.).  When using system settings (i.e. not using %F) this causes all months following %N in the string to be written in words.  When using fixed format (i.e. when using %F) %N may be used alone to insert 
  2169. Times New Roman
  2170. Times New Roman
  2171. Insert the two-digit second component of the time.
  2172. Times New Roman
  2173. Times New Roman
  2174. Insert the two-digit minute component of the time.
  2175. Times New Roman
  2176. Times New Roman
  2177. Insert the two-digit week number in year, counting the first (part) week as week 1.
  2178. Times New Roman
  2179. Times New Roman
  2180. Insert the date suffix. When using system settings (i.e. not using %F), this causes a suffix to be put on any date following %X in the string.  When using fixed format (i.e. using %F), %X following any date appends a suffix for that particular date.  C
  2181. Times New Roman
  2182. Times New Roman
  2183. Insert the four digit year number (in conjunction with %1 etc.). The abbreviation is the last two digits of the year.
  2184. Times New Roman
  2185. Times New Roman
  2186. Insert the three digit day number in year.
  2187. Times New Roman
  2188. Arial
  2189. &Sheet.app
  2190. Arial
  2191. .gCIRCLE _draw
  2192. &gCIRCLE radius%
  2193. gCIRCLE radius%,fill%
  2194. .gCLOCK _time _date _draw
  2195. gCLOCK ON/OFF
  2196. gCLOCK ON,mode%
  2197. gCLOCK ON,mode%,offset&
  2198. gCLOCK ON,mode%,offset&,format$
  2199. gCLOCK ON,mode%,offset&,format$,font%
  2200. gCLOCK ON,mode%,offset&,format$,font%,style%
  2201. .gCLOSE _win _bit
  2202. gCLOSE id%
  2203. Closes the specified drawable that was previously opened by gCREATE, gCREATEBIT or gLOADBIT.
  2204. If the drawable closed was the current drawable, the default window (ID=1) becomes current.
  2205. An error is raised if you try to close the default window.
  2206. .gCLS _draw
  2207. dClears the whole of the current drawable and sets the current position to 0,0, its top left corner.
  2208. .gCOLOR _draw
  2209. gCOLOR red%,green%,blue%
  2210. .gCOPY _win _bit
  2211. gCOPY id%,x%,y%,w%,h%,mode%
  2212. .gCREATE _win
  2213. ?id%=gCREATE(x%,y%,w%,h%,v%)
  2214. id%=gCREATE(x%,y%,w%,h%,v%,flags%)
  2215. .gCREATEBIT _bit
  2216. 2id%=gCREATEBIT(w%,h%)
  2217. id%=gCREATEBIT(w%,h%,mode%)
  2218. .gELLIPSE _draw
  2219. <gELLIPSE hRadius%,vRadius%
  2220. gELLIPSE hRadius%,vRadius%,fill%
  2221. .GEN$ _conv
  2222. g$=gen$(x,y%)
  2223. .GET _key
  2224. g%=GET
  2225. .GET$ _key
  2226. g$=GET$
  2227. .GETCMD$ _opa
  2228. w$=GETCMD$
  2229. .GETDOC$ _opa
  2230. docname$=GETDOC$
  2231. ;Returns the name of the current document.
  2232. See also SETDOC.
  2233. .GETEVENT _event _key _date
  2234. GETEVENT var a%()
  2235. [#.GETEVENT32 _event _key _date _pen
  2236. GETEVENT32
  2237. ev&()
  2238. KDefines a menu. When you have defined all of the menus, use MENU to display them.
  2239. title$ is the name of the menu. From one to eight items on the menu may be defined, each specified by two arguments. The first is the item name, and the second the keycode for a shortcut key. This specifies a key which, when pressed together with the Ctrl (Psion on the Series 3c) key, will select the option. If the keycode is for an upper case key, the shortcut key will use both the Shift and Ctrl (Psion) keys.
  2240. The options can be divided into logical groups by displaying a separating line under the final option in a group. To do this, pass the negative value corresponding to the shortcut key keycode for the final option in the group. For example, -%A specifies shortcut key Ctrl+Shift+A (Shift-Psion-A in Series 3c) and displays a separating line under the associated option in the menu.
  2241. Series 5 supports the following menu features
  2242. * Menu items without shortcuts, by specifying shortcut values between 1 and 32. For these items the value specified is still returned if the item is selected.
  2243. * Menu items which are dimmed, or which have checkboxes or option buttons (sometimes known as radio buttons).
  2244. These extra properties are controlled by adding the following bits to the shortcut key keycode.
  2245. effect                        value
  2246. menu item dimmed                    $1000    
  2247. item has check-box                    $0800
  2248. start of an option button list                $0900    
  2249. middle of an option button list             $0A00
  2250. end of an option button list                $0B00
  2251. checkbox/option button symbol on            $2000
  2252. checkbox/option button symbol indeterminate        $4000    
  2253. The start, middle and end option buttons are for specifying a group of related items that can be selected exclusively (i.e. if one item is selected then the others are deselected). The number of middle option buttons is variable. A single menu card can have more than one set of option buttons and checkboxes, but option buttons in a set should be kept together. For speed, OPL does not check the consistency of these items' specification.
  2254. If a separating line is required when any of these effects had been added, you must be sure to negate the whole value, not just the shortcut key keycode. In the example,
  2255. mCARD "Options","View1",%A OR $2900,"View2",-(%B OR $B00), "Another option",%C
  2256. the second shortcut key keycode and its flag value is correctly negated to display a separating line.
  2257. A 'Too wide' error is raised if the menu title length is greater than or equal to 40.  Shortcut values must be alphabetic character codes or numbers between the values of 1 and 32. Any other values will raise an 'Invalid arguments' error.
  2258. If any menu item fails to be added successfully, a menu is discarded.  It is therefore incorrect to ignore mCARD errors by having  an ONERR label around an mCARD call on the Series 5. If you do, the menu is discarded and a 'Structure fault' will be raised on using mCARD without first using mINIT again.  See MENU for an example of this.
  2259. See mCASC for cascaded menu items.
  2260. See also the 'Friendlier Interaction' chapter.
  2261. .LEFT$ _string
  2262. b$=LEFT$(a$,x%)
  2263. Returns the leftmost x% characters from the string a$.
  2264. For example if n$ has the value Charles, then b$=LEFT$(n$,3) assigns Cha to b$.
  2265. .LEN _string
  2266. a%=LEN(a$)
  2267. Returns the number of characters in a$.
  2268. E.g. if a$ has the value 34 Kopechnie Drive then LEN(a$) returns 18.
  2269. You might use this function to check that a data file string field is not empty before displaying:
  2270. IF LEN(A.client$)
  2271. PRINT A.client$
  2272. ENDIF
  2273. .LENALLOC _mem
  2274. len&=LENALLOC(pcell&)
  2275. .LN _math
  2276. a=LN(x)
  2277. \Returns the natural (base e) logarithm of x.
  2278. Use LOG to return the base 10 log of a number.
  2279. .LOADM _mem
  2280. LOADM module$
  2281. .LOC _string
  2282. a%=LOC(a$,b$)
  2283. .LOCAL _mem
  2284. LOCAL variables
  2285. .LOCK _opa
  2286. LOCK ON
  2287. LOCK OFF
  2288. .LOG _math
  2289.     a=LOG(x)
  2290. MReturns the base 10 logarithm of x.
  2291. Use LN to find the base e (natural) log.
  2292. .LOPEN _device
  2293. LOPEN device$
  2294. .LOWER$ _string
  2295. b$=LOWER$(a$)
  2296. Converts any upper case characters in the string a$ to lower case and returns the completely lower case string.
  2297. E.g. if a$="CLARKE", LOWER$(a$) returns the string "clarke"
  2298. Use UPPER$ to convert a string to upper case.
  2299. .LPRINT _device _text
  2300. LPRINT list of expressions
  2301. .MAX _math
  2302. #m=MAX(list)
  2303. m=MAX(array(),element)
  2304. .mCARD _menu
  2305. 7mCARD title$,n1$,k1%
  2306. mCARD title$,n1$,k1%,n2$,k2% etc.
  2307. .mCASC _menu
  2308. -mCASC title$,item1$,hotkey1%,item2$,hotkey2%
  2309. .MEAN _math
  2310. %m=MEAN(list)
  2311. m=MEAN(array(),element)
  2312. KFReturns a string containing the hexadecimal (base 16) representation of integer or long integer x&.
  2313. For example HEX$(255) returns the string "FF".
  2314. Notes
  2315. To enter integer hexadecimal constants (16 bit) put a $ in front of them. For example $FF is 255 in decimal. (Don't confuse this use of $ with string variable names.)
  2316. To enter long integer hexadecimal constants (32 bit) put a & in front of them. For example &FFFFF is 1048575 in decimal.
  2317. Counting in hexadecimal is done like this: 0 1 2 3 4 5 6 7 8 9 A B C D E F 10... where A stands for decimal 10, B for decimal 11, C for decimal 12 ... up to F for decimal 15. After F comes 10, which is equivalent to decimal 16. To understand numbers greater than hexadecimal 10, again compare hexadecimals with decimals. In these examples, 102 means 10(10, 103 means 10(10(10 and so on.
  2318. 253 in decimal is:
  2319. (2(102)+(5(101)+(3(100) = (2(100)+(5(10)+(3(1) = 200+50+3
  2320. By analogy, &253 in hexadecimal is:
  2321. (&2(162)+(&5(161)+(&3(160) =(2(256)+(5(16)+(3(1) =512+80+3 = 595 in decimal.
  2322. Similarly, &A6B in hexadecimal is:
  2323. (&A(162)+(&6(161)+(&B(160) =(10(256)+(6(16)+(11(1) =2560+96+11 = 2667 in decimal.
  2324. You may also find this table useful for converting between hex and decimal:
  2325. hex             decimal    
  2326. &1              1    =160
  2327. &10              16    =161
  2328. &100             256    =162
  2329. &1000            4096    =163
  2330. For example, &20F9 is
  2331. (2(&1000)+(0(&100)+(15(&10)+9 which in decimal is: (2(4096)+(0(256)+(15(16)+9 = 8441.
  2332. All hexadecimal constants are integers ($) or long integers (&). So arithmetic operations involving hexadecimal numbers behave in the usual way. For example, &3/&2 returns 1, &3/2.0 returns 1.5, 3/$2 returns 1.
  2333. .gSETWIN _win
  2334. +gSETWIN x%,y%,width%,height%
  2335. gSETWIN x%,y%
  2336. .gSTYLE _gtext _font
  2337. gSTYLE style%
  2338. .gTMODE _gtext
  2339. gTMODE mode%
  2340. .gTWIDTH _gtext _fon
  2341. width%=gTWIDTH(text$)
  2342. iReturns the width of text$ in the current font and style.
  2343. See also gPRINT, gPRINTB, gPRINTCLIP, gXPRINT.
  2344. .gUNLOADFONT _gtext _fon
  2345. gUNLOADFONT fileId%
  2346. Unloads a user-defined font that was previously loaded using gLOADFONT. Raises an error if the font has not been loaded.
  2347. The built-in fonts are not held in memory and cannot be unloaded.
  2348. See also gLOADFONT.
  2349. .gUPDATE _win _draw
  2350. gUPDATE ON
  2351. gUPDATE OFF
  2352. gUPDATE
  2353. .gUSE _win _bit
  2354.     gUSE id%
  2355. Makes the drawable id% current. Graphics drawing commands will now go to this drawable. gUSE does not bring a drawable to the foreground (see gORDER).
  2356. .gVISIBLE _win
  2357. gVISIBLE ON
  2358. gVISIBLE OFF
  2359. dMakes the current window visible or invisible.
  2360. Raises an error if the current drawable is a bitmap.
  2361. .gWIDTH _win _bit
  2362. width%=gWIDTH
  2363. +Returns the width of the current drawable.
  2364. .gX _draw
  2365. x%=gX
  2366. KReturns the x current position (in from the left) in the current drawable.
  2367. .gXBORDER _draw _win
  2368. 2gXBORDER type%,flags%,w%,h%
  2369. gXBORDER type%,flags%
  2370. .gXPRINT _gtext
  2371. gXPRINT string$,flags%
  2372. .gY _draw
  2373. y%=gY
  2374. LReturns the y current position (down from the top) in the current drawable.
  2375. .HEX$ _conv
  2376. h$=HEX$(x&)
  2377. .HOUR _time
  2378. h%=HOUR
  2379. ]Returns the number of the current hour from the system clock as an integer between 0 and 23.
  2380. .IABS _conv
  2381. i&=IABS(x&)
  2382. Returns the absolute value, i.e. without any sign, of the integer or long integer expression x&.
  2383. For example IABS(-10) is 10.
  2384. See also ABS, which returns the absolute value as a floating-point value.
  2385. FGets general information about the current drawable and about the graphics cursor (whichever window it is in). This replaces gINFO because the information available has changed.  i&() must have 48 elements (although elements 37 to 48 are currently unused).  
  2386. i&(1)        reserved
  2387. i&(2)        reserved
  2388. i&(3)        font height
  2389. i&(4)        font descent
  2390. i&(5)        font ascent
  2391. i&(6)        width of '0' character
  2392. i&(7)        maximum char width
  2393. i&(8)        flags for font (any combination):
  2394.         1    uses ASCII set (32-126)
  2395.         2    uses Code Page 850 set (128-255)
  2396.         4    bold
  2397.         8    italic
  2398.         16    serif
  2399.         32    monospaced
  2400.         $8000    font is stored expanded for quick drawing
  2401. i&(9)        the font UID as used in gFONT
  2402. i&(10-17)     unused
  2403. i&(18)        current gGMODE
  2404. i&(19)        ... gTMODE
  2405. i&(20)        ... gSTYLE
  2406. i&(21)        cursor state (ON=1, OFF=0)
  2407. i&(22)        ID of window containing cursor (-1 for text cursor)
  2408. i&(23)        cursor width
  2409. i&(24)        ... height
  2410. i&(25)        ... ascent
  2411. i&(26)        ... x position
  2412. i&(27)        ... y position
  2413. i&(28)        1 if drawable is a bitmap
  2414. i&(29)        cursor effects (combination):
  2415.         (i%(29) AND 1)    obloid (not on S5)
  2416.         (    .    .    .    2)    not flashing
  2417.         (    .    .    .    4)    grey
  2418. i&(30)    graphics colour-mode of current window
  2419. i&(31)    gCOLOR red% of foreground
  2420. i&(32)    gCOLOR green% of foreground
  2421. i&(33)    gCOLOR blue% of foreground
  2422. i&(34)    gCOLOR red% of background
  2423. i&(35)    gCOLOR green% of background
  2424. i&(36)    gCOLOR blue% of background
  2425. Additionally note that on the Series 5, i&(8)=2 means that Code Page 1252 is used (rather than Code Page 850) and also that there is no obloid cursor, so bit 0 will never be set in i&(29).
  2426. See also gINFO, gFONT, gCOLOR, gCREATE.
  2427. xR[$.GETEVENTA32 _event _key _date _pen
  2428. GETEVENTA32 status%,ev&()
  2429. .GETEVENTC _event _key _date
  2430. GETEVENTC(var stat%)
  2431. Cancels the previously called GETEVENTA32 function with status stat%. Note that GETEVENTC consumes the signal (unlike IOCANCEL), so IOWAITSTAT should not be used after GETEVENTC.
  2432. See the 'Advanced Topics' chapter for details.
  2433. .gFILL _draw
  2434. gFILL width%,height%,gMode%
  2435. Fills a rectangle of the specified size from the current position, according to the graphics mode specified.
  2436. The current position is unaffected.
  2437. .gFONT _gtext _font
  2438. gFONT fontUid&
  2439. .gGMODE _draw
  2440. gGMODE mode%
  2441. .gGREY _draw
  2442. gGREY mode%
  2443. .gHEIGHT _win _bit
  2444. height%=gHEIGHT
  2445. ,Returns the height of the current drawable.
  2446. .gIDENTITY _win
  2447. id%=gIDENTITY
  2448. EReturns the ID of the current drawable.
  2449. The default window has ID=1.
  2450. [ .gINFO32 _win _bit _font _gtext
  2451. gINFO32 var i&()
  2452. .gINVERT _draw
  2453. gINVERT width%,height%
  2454. xInverts the rectangle width% to the right and height% down from the cursor position, except for the four corner pixels.
  2455. .GIPRINT _gtext
  2456. gIPRINT str$,c%
  2457. gIPRINT str$
  2458. .gLINEBY _draw
  2459. gLINEBY dx%,dy%
  2460. .gLINETO _draw
  2461. gLINETO x%,y%
  2462. .gLOADBIT _bit
  2463. Qid%=gLOADBIT(name$,write%,index%)
  2464. id%=gLOADBIT(name$,write%)
  2465. id%=gLOADBIT(name$)
  2466. .gLOADFONT _gtext _font
  2467. fileId%=gLOADFONT(file$)
  2468. .GLOBAL _mem
  2469. GLOBAL variables
  2470. +AReturns the absolute value of a floating-point number that is, without any +/- sign for example ABS(-10.099) is 10.099
  2471. If x is an integer, you won
  2472. t get an error, but the result will be converted to floating-point for example ABS(-6) is 6.0. Use IABS to return the absolute value as a long integer.
  2473. gInfo?
  2474. .ABS _conv
  2475.     a=ABS(x)
  2476. .ACOS _math
  2477. a=ACOS(x)
  2478. Returns the arc cosine, or inverse cosine (COS-1) of x.
  2479. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.
  2480. .ADDR _mem
  2481. a&=ADDR(variable)
  2482. .ADJUSTALLOC _mem
  2483. %pcelln&=ADJUSTALLOC(pcell&,off&,am&)
  2484. .ALERT _dialog
  2485. nr%=ALERT(m1$,m2$,b1$,b2$,b3$)
  2486. r%=ALERT(m1$,m2$,b1$,b2$)
  2487. r%=ALERT(m1$,m2$,b1$)
  2488. r%=ALERT(m1$,m2$)
  2489. r%=ALERT(m1$)
  2490. .ALLOC _mem
  2491. pcell&=ALLOC(size&)
  2492. .APP _opa
  2493. APP caption,uid&
  2494. AReturns the character code of the key last pressed, if there has been a keypress since the last use of the keyboard by INPUT, EDIT, GET, GET$, KEY, KEY$, MENU and DIALOG.
  2495. If no key has been pressed, zero is returned.
  2496. See Appendix D for a list of special key codes. You can use KMOD to check whether modifier keys (Shift, Control, Fn (on the Series 5), Psion (on the Series 3c) and Caps Lock) were used.
  2497. This command does not wait for a key to be pressed, unlike GET.
  2498. .VAR _math
  2499. #v=VAR(list)
  2500. v=VAR(array(),element)
  2501. .VECTOR _control
  2502. )VECTOR i%
  2503.     label1,label2,...,labelN
  2504. .WEEK _date
  2505. w%=WEEK(day%,month%,year%)
  2506. .WHILE...ENDWH _control
  2507. WHILE expression
  2508. ENDWH
  2509. .YEAR _date
  2510. y%=YEAR
  2511. nReturns the current year as an integer from the system clock.
  2512. For example, on 5th May 1997 YEAR returns 1997.
  2513. .POKE commands _mem
  2514. .KEY _key
  2515. k%=KEY
  2516. Arial
  2517. Courier
  2518. Arial
  2519. " Syntax for OPL on Psion Series 5
  2520. Available, along with other doc in DATA, at
  2521. http://www.knoware.nl/users/wsmout/s5doc.html
  2522. comments to wsmout@knoware.nl
  2523. .ABS _conv
  2524.     a=ABS(x)
  2525. .ACOS _math
  2526. a=ACOS(x)
  2527. Returns the arc cosine, or inverse cosine (COS-1) of x.
  2528. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.
  2529. .ADDR _mem
  2530. a&=ADDR(variable)
  2531. .ADJUSTALLOC _mem
  2532. %pcelln&=ADJUSTALLOC(pcell&,off&,am&)
  2533. .ALERT _dialog
  2534. nr%=ALERT(m1$,m2$,b1$,b2$,b3$)
  2535. r%=ALERT(m1$,m2$,b1$,b2$)
  2536. r%=ALERT(m1$,m2$,b1$)
  2537. r%=ALERT(m1$,m2$)
  2538. r%=ALERT(m1$)
  2539. .ALLOC _mem
  2540. pcell&=ALLOC(size&)
  2541. .APP _opa
  2542. APP caption,uid&
  2543. " Syntax for OPL on Psion Series 5
  2544. vs 1 01-08-98
  2545. xAvailable, along with other doc in DATA, at
  2546. http://www.knoware.nl/users/wsmout/s5doc.html
  2547. comments to wsmout@knoware.nl
  2548. .ABS _conv
  2549.     a=ABS(x)
  2550. .ACOS _math
  2551. a=ACOS(x)
  2552. Returns the arc cosine, or inverse cosine (COS-1) of x.
  2553. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.
  2554. .ADDR _mem
  2555. a&=ADDR(variable)
  2556. .ADJUSTALLOC _mem
  2557. %pcelln&=ADJUSTALLOC(pcell&,off&,am&)
  2558. .ALERT _dialog
  2559. nr%=ALERT(m1$,m2$,b1$,b2$,b3$)
  2560. r%=ALERT(m1$,m2$,b1$,b2$)
  2561. r%=ALERT(m1$,m2$,b1$)
  2562. r%=ALERT(m1$,m2$)
  2563. r%=ALERT(m1$)
  2564. .ALLOC _mem
  2565. pcell&=ALLOC(size&)
  2566. .APP _opa
  2567. APP caption,uid&
  2568.